How to Automatically Number Detail Pages in Microsoft Visio
Question details
The user needs to automate the page numbering for Visio detail pages in a specific format (e.g., D1 of Total), ensuring it updates dynamically when pages are added or removed.

- Product
- Microsoft Visio
- Device & OS
- not provided
- Scenario
- Managing a multi-page Visio document that contains a mix of main pages and a varying number of detail pages.
- Observed behavior
- The current numbering formula relies on a fixed, hardcoded total (e.g., 13), causing the page labels to become inaccurate whenever new detail pages are inserted or existing ones are deleted.
Ensure that all your detail pages share the exact same background page in Visio, as this shared background will be used as the criteria to count them dynamically.
Use Visio ShapeSheet Formulas to Dynamically Count Detail Pages
By replacing the fixed number with a dynamic ShapeSheet calculation that counts pages sharing the detail background, your page labels will automatically update during document edits.
Instead of hardcoding a total like '13' in your text fields, you can leverage Visio's Document ShapeSheet to count how many pages use a specific background. Combining this with the PageNumber() function ensures accurate numbering regardless of page insertion or deletion.
Open Microsoft Visio and navigate to File > Options > Advanced. Scroll down to the General section at the bottom and check the box for 'Run in developer mode', then click OK.
Right-click anywhere on a blank space within your drawing page, select 'Show ShapeSheet', and choose 'Document'.
In the ShapeSheet window, scroll to the 'User-defined Cells' section. Right-click the section, choose 'Insert Row', and name the new row 'User.TotalDetailPages'.
In the Value cell for User.TotalDetailPages, enter a formula that counts the pages linked to your detail background. For example, if you use a specific background, write a formula utilizing the appropriate document scope to sum them up.
Go to your detail background page, insert a text box, and use the Field dialog to insert a custom formula: ="D" & PageNumber() & " of " & TheDoc!User.TotalDetailPages.

Try WPS Office for Free Diagramming and Documentation
While complex ShapeSheet programming requires Microsoft Visio, WPS Office offers a fantastic free alternative for managing everyday documents, spreadsheets, presentations, and standard flowcharts without the hefty price tag.
- 1. Download WPS Office: Visit the official WPS website and download the free installer for your operating system.
- 2. Install the Suite: Run the setup file and follow the quick installation prompts to get started.
- 3. Start Creating Diagrams: Open WPS Writer or Presentation, navigate to the Insert tab, and use the Shapes feature to build your diagrams.

Frequently Asked Questions
How do I access the ShapeSheet in Microsoft Visio?
To access the ShapeSheet, you must first enable Developer Mode in Visio Options under the Advanced settings. Once enabled, you can right-click any shape, page, or the document canvas and select 'Show ShapeSheet'.
Why isn't my page number updating when I delete a Visio page?
If your total page count is typed as plain text (like '13') instead of a dynamic field, it will not update automatically. You must use Visio's Insert Field feature combined with the PageNumber() function to ensure dynamic updates.
Can I use different numbering systems for main pages and detail pages?
Yes. By assigning a distinct background page for main pages and another for detail pages, you can insert different ShapeSheet formulas into each background. This isolates the numbering so that detail pages count independently from main pages.




