Very simple need but solution escapes me at the moment.
I want to move page 1 after page 2 - with page 2 now becoming the first page
in the document.
I can select the page by using:
Set objPage = ActiveDocument.ActiveWindow.Panes(1).Pages.Item(1)
I can't figure out how to move it.
I have to do this to a large number of documents and may need to repeat the
process in the future.
I could select the page like you did, but maybe something like:
Sub CutFirstPageToAfterSecondPage()
Dim oDoc As Document
Set oDoc = ActiveDocument
oDoc.Range(0, 0).Select
oDoc.Bookmarks("\Page").Range.Cut
oDoc.Bookmarks("\Page").Select
With Selection
.Collapse wdCollapseEnd
.InsertBreak Type:=wdSectionBreakNextPage
.Paste
End With
End Sub
Dkline - 10 Jan 2005 16:38 GMT
My apologies for not replying earlier. Works like a champ. Thank you!
>I could select the page like you did, but maybe something like:
>
[quoted text clipped - 11 lines]
> End With
> End Sub
Dkline was telling us:
Dkline nous racontait que :
> Very simple need but solution escapes me at the moment.
>
[quoted text clipped - 8 lines]
> I have to do this to a large number of documents and may need to
> repeat the process in the future.
Or, if you really want to use the page object collection,
Try this:
'_______________________________________
Dim objPage As Page
Dim MyRect As Rectangle
Dim myRange1 As Range
Dim myRange2 As Range
Set objPage = ActiveDocument.ActiveWindow.Panes(1).Pages(1)
Set MyRect = objPage.Rectangles(1)
Set myRange1 = MyRect.Range
Set objPage = ActiveDocument.ActiveWindow.Panes(1).Pages(2)
Set MyRect = objPage.Rectangles(1)
Set myRange2 = MyRect.Range
myRange1.Cut
myRange2.InsertParagraphAfter
myRange2.Collapse wdCollapseEnd
myRange2.InsertBreak wdSectionBreakNextPage
myRange2.Collapse wdCollapseEnd
myRange2.Paste
'_______________________________________

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org