Move to next page

N

North Wales

Hi,

I have found the following code on here to get to the next page.

MyPage = Selection.Information(wdActiveEndPageNumber)
Selection.GoTo What:=wdGoToPage, Name:=MyPage + 1

But what if there is no next page?
How could i adapt this so that if there is no next page it creates one and
moves to it
 
S

StevenM

To: North Wales,

You can use: Selection.Information(wdNumberOfPagesInDocument)
to find out how many pages are in your document.
But as to adding a new page, it depends on how you want to add a page.
Do you want to simply add empty paragraphs?
Do you want to add a page break? What?

Steven Craig Miller
 
S

StevenM

To: Rich,

(a) Insert new page with page break

Selection.EndOf Unit:=wdStory, Extend:=wdMove
Selection.InsertBreak Type:=wdPageBreak

(b) Insert Paragraphs Until there is a new page

Dim nPages As Long
nPages = Selection.Information(wdNumberOfPagesInDocument)
Selection.EndOf Unit:=wdStory, Extend:=wdMove
While (nPages = Selection.Information(wdNumberOfPagesInDocument))
Selection.InsertParagraphAfter
Wend

Steven Craig Miller
 

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