|
▼あおぎんこ さん:
これだとどうなりますか
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=myPage
動作確認のために、ほとんど同じですが、書き換えてみました。
Sub test()
Dim mySplit As Long
Dim doc As Document
Dim myTotalPage As Long
Dim myPage As Range
Dim r As Range
Dim k As Long
mySplit = 2
Set doc = ActiveDocument
myTotalPage = doc.Range.Information(wdNumberOfPagesInDocument)
Set myPage = doc.Range(0, 0)
Set r = myPage
k = 0
Do Until k > myTotalPage
k = k + mySplit
myPage.Start = r.End
If k >= myTotalPage Then
myPage.End = doc.Range.End
Else
Set r = r.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=k + 1)
myPage.End = r.Start - 1
End If
myPage.Copy
Documents.Add.Range.Paste
Loop
End Sub
|
|