In lengthy technical reports, legal filings, books, and user manuals, referring readers to figures, tables, appendices, or specific headings located elsewhere in the document is a frequent requirement. Hardcoding literal page numbers (such as “see Figure 3 on page 42”) is prone to error because any subsequent text edits, image insertions, or margin adjustments shift pagination and invalidate manual references. Microsoft Word solves this problem with the PAGEREF field code, which creates a dynamic link to a document bookmark and outputs the exact, real-time page number where that bookmark currently resides.
How the PAGEREF Field Operates
The PAGEREF field code searches the document for a specified bookmark name and evaluates the physical page number on which the start of that bookmark is rendered during layout calculation. Whenever the target content moves forward or backward as pagination changes, updating document fields immediately synchronises the displayed number.
The basic syntax for the field is:
{ PAGEREF BookmarkName [Switches] }
For example, if you place a bookmark named FinancialSummary on a table that shifts from page 12 to page 18 after content revisions, { PAGEREF FinancialSummary } automatically evaluates to 18.
Creating Target Bookmarks in Microsoft Word
Before you can reference a page number using PAGEREF, the target destination must have a named bookmark:
- In your Word document, select the heading, table caption, figure, or text snippet you want to reference.
- Navigate to the Insert tab on the Ribbon.
- In the Links group, click Bookmark.
- In the Bookmark dialogue box, enter a concise, descriptive name (for example,
App_DatabaseSchemaorSec_InstallationGuide). Bookmark names must begin with a letter and cannot contain spaces (use underscores instead). - Click Add.
Inserting the PAGEREF Field Manually
While Word provides a Cross-Reference GUI dialogue, manually constructing the PAGEREF field allows you to apply formatting switches, suppress extra text, and embed dynamic relative directional terms.
- Place your cursor where the page reference should appear (for example:
For detailed schematics, refer to page). - Press Ctrl + F9 (or Command + F9 on macOS) to generate the field brackets:
{ }. - Inside the brackets, type
PAGEREFfollowed by the exact bookmark name:{ PAGEREF App_DatabaseSchema } - Press F9 to evaluate and render the field. The brackets collapse, and the current page number appears.
PAGEREF Field Switches and Custom Formatting
The PAGEREF field supports specialized switches that enhance usability in printed and electronic documents:
| Switch | Function | Example Construction |
|---|---|---|
\h |
Creates a clickable hyperlink to the bookmarked location in electronic formats (Word & PDF). | { PAGEREF App_DatabaseSchema \h } |
\p |
Inserts relative position indicator text (outputs “above” or “below” depending on page location). | { PAGEREF App_DatabaseSchema \p } |
\* Roman |
Formats the resulting page number in uppercase Roman numerals (e.g., XII). | { PAGEREF App_DatabaseSchema \* Roman } |
\* roman |
Formats the resulting page number in lowercase Roman numerals (e.g., xii). | { PAGEREF App_DatabaseSchema \* roman } |
\* Arabic |
Formats the resulting page number in standard Arabic numerals (e.g., 12). | { PAGEREF App_DatabaseSchema \* Arabic } |
Combining Hyperlinks with Relative Positioning
You can combine the \h switch with the \p switch to create interactive, contextual reading cues. For instance:
See the configuration diagram { PAGEREF Fig_NetworkTopology \p \h } on page { PAGEREF Fig_NetworkTopology \h }.
If the diagram is positioned on a later page, Word renders this as: “See the configuration diagram below on page 24.” Both the word “below” and the page number “24” function as clickable hyperlinks leading directly to the bookmarked figure.
Updating and Locking PAGEREF Fields
Page number references calculate dynamically during document layout recalculations, but manual updates ensure complete accuracy before exporting or printing:
- Update All Document Fields: Press Ctrl + A to select the entire document, then press F9.
- Toggle Field Codes: Press Alt + F9 (or Option + F9 on macOS) to switch between the raw code
{ PAGEREF BookmarkName }and the rendered number value. - Lock Field Values: If you must freeze a page reference before distributing a static draft, select the field and press Ctrl + F11. To unlock the field for future recalculation, press Ctrl + Shift + F11.
Resolving “Error! Bookmark not defined”
If a PAGEREF field displays Error! Bookmark not defined, verify the following causes:
- Deleted Bookmarks: If the text containing the original bookmark was deleted or replaced during editing, the bookmark is removed. Re-select the destination content and re-add the bookmark with the exact original name.
- Typographical Discrepancies: Bookmark names in Word are case-insensitive, but spelling mistakes or extra spaces in the field code prevent resolution. Toggle field codes (Alt + F9) and check the bookmark name.
- Track Changes: If the bookmark was added inside a tracked change that has not been accepted, pagination and field engines may fail to locate the anchor until changes are committed.