NextPage, NextPage()

Syntax

NextPage

NextPage()

Remarks

The NextPage statement scrolls forward one page in page layout view without moving the insertion point (the same as clicking the Page Forward button at the bottom of the vertical scroll bar in page layout view). If you want to move the insertion point after scrolling, include a StartOfWindow statement following NextPage in your macro.

NextPage scrolls from the current location on one page to the same relative location on the next page. To scroll to the beginning of the next page regardless
of what portion of the current page appears, use the instruction EditGoTo .Destination = "p" instead of NextPage. Note, however, that EditGoTo also moves the insertion point.

The NextPage() function behaves the same as the statement and also returns the following values.

Value

Explanation

0 (zero)

If there is no next page (in other words, if the document doesn't scroll)

1

If the document scrolls


Note

NextPage and NextPage() are available only in page layout view and generate an error if run in another view.

Example

This example scrolls forward one page and positions the insertion point at the top of the document window. If the document has scrolled as far as possible, a message box is displayed.


ViewPage
If NextPage() = 0 Then
    MsgBox "Can't scroll!"
Else
    StartOfWindow
End If

See Also

EditGoTo, PageDown, PrevPage, ViewPage, VPage