|
sxhus 发表于 2011-11-5 10:33
可否给(根据分页符拆分文档拆分成一个一个文档),文件名我自己考虑
根据分页符拆分应该不难:- Sub CFBYFJF()
- 'by Word爱好者Q群[5090217]
- Dim tempDoc As Document
- Dim wRng As Range
- Dim tempPar As Paragraph
- Dim tempStr As String
- Set wRng = ThisDocument.Content
- With wRng.Find
- .ClearFormatting
- .Replacement.ClearFormatting
- Do While wRng.Start <> ThisDocument.Content.End - 1
- If .Execute(findtext:="*^m", MatchWildcards:=True) Then
- Range(wRng.Start, wRng.End - 1).Copy
- Else
- wRng.Copy
- End If
- Set tempDoc = Documents.Add(Visible:=False)
- tempDoc.Content.Paste
- tempDoc.SaveAs ThisDocument.Path & Application.PathSeparator & 文件名 & ".doc"
- tempDoc.Close True
- wRng.SetRange wRng.End, ThisDocument.Content.End
- Loop
- End With
- Set RegExp = Nothing
- End Sub
复制代码 |
|