Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2018 by Barry MacDonnell. All Rights Reserved.

Page updated May 15, 2018

"Go to page <number>"

Download GO2PAGE.ZIP (v1.01; 03/07/06; 3,903 bytes)

Compatible with WordPerfect 10 and later versions (Go to page number.wcm also works in earlier versions but is unnecessary in those versions.)

WordPerfect 11 users: See important information about using macros in the first release of WP11 (11.0.0.233) at the top of this page.

Downloading, Documentation, Modifications, and Support

The Edit, Go To, Page feature is slightly more complex in WordPeffect 10+ than in earlier versions. For those who want to go to a specific page number in WP10+ with fewer keystrokes, here's a small macro (Go to page number.wcm) to do it.

You can assign it to a keystroke for convenience. The default "Go To" dialog is <Ctrl+G>, so assigning it to <Alt+G> might be useful.

◄- The downloadable compiled macro is included inside the Zip file in the left column. But for those who want to view the raw (plain text) macro code, see below.

(To copy the code into your WordPerfect program to create a working macro see here. Or just download the compiled version from the left column.)

// Macro code begins here

Application (WordPerfect; "WordPerfect"; Default!)

OnCancel(End@)

// Store the current page number -
vStartPage:=?Page

// Get the desired page number from the user -
Label(GetNumb@)
GETNUMBER (vNewPage;
    "Enter the page number to go to: ";
    "'Go to Page Number' - (c) 2006 by Barry MacDonnell")
If (vNewPage<=0)  // (error check)
    Messagebox(;"Error";
    "You must enter a number greater than 0 (zero).")
    vNewPage:=""  // (discard value)
    Go(GetNumb@)  // (loop back and redisplay dialog)
Endif

// Go to the desired page -
PosPage (Volume:NoneSpecified!; Chapter:NoneSpecified!; Page: vNewPage)

// Get the actual destination page's number (it could be less than the input number) -
vEndPage:=?Page

// Display appropriate message -
Display(On!)
If (vNewPage>vEndPage)   // (if input number is larger than destination page number)
    If(vEndPage=vStartPage)  // (if they are the same, display message and quit)
        Messagebox(;"Note -";
        "You are already at the end of the document - there is no page "+vNewPage ;
        IconExclamation!) 
        Go(End@)
    Endif
    Messagebox(vAns;"Note -";
    "You are now at the end of the document - there is no page "
     +vNewPage+NToC(0F90Ah)+NToC(0F90Ah)+
    "Remain at this location? (No=Return to previous page)" ;
    YesNo!|IconQuestion!)
    If(vAns=2 or vAns=6) Go(End@) Endif  // (if Cancel message or Yes, quit now)
    If(vAns=7)
        PosPage (Volume:NoneSpecified!; Chapter:NoneSpecified!; Page: vStartPage)
        Go(End@)
    Endif
Endif
If (vEndPage=vStartPage)
    Messagebox(;"Note -";
    "You are already on page "+vStartPage)
    Go(End@)
Endif

Label(End@)
Return

// Macro ends here