How to Add Page Labels After Manual Page Breaks in Word Using VBA
Question details
The user needs to insert custom, accessible page labels (such as "[Page 1]") immediately after manual page breaks using a VBA macro, avoiding standard headers and footers.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Preparing a document with fixed page boundaries for accessibility purposes where standard page numbering controls aren't sufficient.
- Observed behavior
- The user attempted a VBA script, but the page labels appeared at the top of the document instead of directly after each manual page break.
Before running any VBA macro, ensure your document's manual page breaks are finalized, as inserting text directly into the document body can alter pagination and shift your layout.
Use a VBA Macro to Insert Labels After Page Breaks
Execute a customized VBA script to search for manual page breaks and insert your specific page label format.
Since Word reflows text dynamically, hardcoding page numbers into the body can be tricky. A VBA macro can automate finding manual page breaks (^m) and appending custom text like '[Page X]' directly after them.
Press Alt + F11 to open the Visual Basic for Applications (VBA) Editor in Word.
Go to the 'Insert' menu at the top and select 'Module' to create a blank script window.
Write or paste a VBA script designed to loop through the document's Find object, searching for manual page breaks (^m) and inserting the label text with an incrementing counter variable.
Press F5 or click the 'Run' button. Check the document to verify that the labels appear correctly after each break.

Use Inline Page Number Fields
Insert dynamic page number fields directly into the document body to avoid VBA complexities.
Export to PDF for Better Accessibility
Convert the final document to PDF to ensure stable pagination and reliable screen reader compatibility.
Automate Document Formatting with WPS Writer
WPS Office provides robust support for VBA macros and advanced document formatting. You can easily manage manual page breaks, insert custom fields, and ensure your documents are accessible without hassle.
- 1. Install WPS Office: Download and install WPS Office for free from the official website.
- 2. Open Your Document: Launch WPS Writer and open your existing document containing manual page breaks.
- 3. Access the Developer Tools: Go to the Developer tab to access the VBA Editor and write or paste your macro.
- 4. Execute or Insert Fields: Run the macro or use the 'Insert' tab to manually place field codes for your custom page labels.

Frequently Asked Questions
Why does inserting text after a page break change my document layout?
Word processors dynamically reflow text based on page size and margins. Adding fixed text like a page label directly into the body takes up space, which can push subsequent lines onto a new page if the current page is already full.
How can I start my page labels at a number other than 1?
In your VBA macro, you can initialize your counter variable to your desired starting number before starting the find-and-replace loop. If using inline Page fields, you can adjust the starting page number in the 'Page Number Format' dialog box.
Can I use page number fields outside of headers and footers?
Yes. You can insert a Page Number field anywhere in the document body by pressing Ctrl+F9, typing 'PAGE' inside the field brackets, and pressing F9 to update it.
Why is exporting to PDF recommended for screen readers?
PDFs lock the visual layout and pagination, preventing unwanted text reflow. They also support strict accessibility tags that screen readers can parse reliably, making document navigation easier for visually impaired users.




