|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
确实存在问题(比如共5页就出错了),这是最新修改的,请测试。
Sub 每两页一文档3()
Application.ScreenUpdating = False
Dim s%, mydoc
For s = 1 To ActiveDocument.Range.Information(wdNumberOfPagesInDocument) Step 2
With ActiveDocument
.Range(.GoTo(wdGoToPage, wdGoToNext, , s).Start, VBA.IIf(s + 2 <= ActiveDocument.Range.Information(wdNumberOfPagesInDocument), .GoTo(wdGoToPage, wdGoToNext, , s + 2).Start - 1, .Content.End - 1)).Copy
End With
Set mydoc = Documents.Add(Visible:=False)
With mydoc
.Content.Paste
.SaveAs (s + 1) / 2 & ".doc"
.Close
End With
Set mydoc = Nothing
Next
Application.ScreenUpdating = True
End Sub |
|