Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Move A Page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dkline - 06 Jan 2005 13:33 GMT
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.
Greg - 06 Jan 2005 16:23 GMT
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
Jean-Guy Marcil - 06 Jan 2005 18:41 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.