一个word文档如何按页数保存为多个word文档(4000多页呢)不是用复制和粘贴得那种!!!

来源:百度知道 编辑:UC知道 时间:2024/06/01 08:53:57

运行宏:
———————————————————————————————————

Sub aa()
myPath = "D:\temp\"
Selection.HomeKey Unit:=wdStory
Set myRange = Selection.Range
curpage = 0
Application.ScreenUpdating = False
Do
prepage = curpage
pagenum = pagenum + 1
Set myRange = myRange.GoToNext(What:=wdGoToPage)
curpage = myRange.Start
endpage = myRange.Previous.End 'Start
If curpage = prepage Then _
endpage = ActiveDocument.Content.End
ActiveDocument.Range(prepage, endpage).Copy
With Documents.Add
.Content.Paste
.SaveAs myPath & "Page" & pagenum & ".doc"
.Close
End With
If curpage = prepage Then Exit Do
Loop
Application.ScreenUpdating = True
End Sub
-----------------------------------------------------------------