Move A Page

D

Dkline

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.
 
G

Greg

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
 
J

Jean-Guy Marcil

Dkline was telling us:
Dkline nous racontait que :
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.

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
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top