How to Use VBA to Update Word Footers on Every Page Except the First
Question details
A user needs to update the footer on every page except the first using a VBA procedure, but the current macro only updates the final page.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Automating document formatting using a VBA macro to apply a consistent footer from the second page onward.
- Observed behavior
- The macro correctly inserts a footer but fails to apply it to all applicable pages, updating only the footer on the final page of the document.
Verify that your document sections are set up correctly, as Word footers are controlled by sections rather than individual pages. Save a backup copy of your document before running or testing new VBA macros.
Link Footers to Previous Sections via VBA
Iterate through the document's sections and enable the LinkToPrevious property so the footer propagates automatically after the first section.
In Word, headers and footers belong to sections, not individual pages. If a document has multiple sections, modifying the footer in one section might not affect the others. By linking sections together, you only need to define the footer once.
Press ALT + F11 to open the Visual Basic for Applications (VBA) editor and locate the macro you are working on.
Ensure that your code sets 'ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True' so the first page remains unaffected by subsequent footer changes.
Use a 'For' loop to iterate from Section 2 to the end of the document (e.g., 'For i = 2 To ActiveDocument.Sections.Count').
Inside the loop, apply 'ActiveDocument.Sections(i).Footers(wdHeaderFooterPrimary).LinkToPrevious = True' to link the footers across all subsequent sections.

Manually Update Each Section's Footer
Directly insert the footer content into each relevant section if you cannot use linked sections due to unique document formatting.
Manage Headers, Footers, and Macros Seamlessly with WPS Writer
WPS Writer provides robust support for document sections, advanced header/footer settings, and VBA macros, allowing you to automate formatting tasks effortlessly without extensive coding.
- 1. Open Your Document: Launch WPS Writer and open your macro-enabled document.
- 2. Access Header and Footer Settings: Navigate to the 'Insert' tab and click on 'Header and Footer' to open the dedicated editing ribbon.
- 3. Apply Section Settings: Check the 'Different First Page' option from the ribbon to isolate your first page without writing any VBA code.
- 4. Run Your Macros: Go to the 'Developer' tab to access the VBA Editor and execute your macro to apply batch changes instantly.

Frequently Asked Questions
Why does my VBA macro only update the footer on the last page?
Word footers are controlled by sections, not pages. If your document has multiple sections and your VBA code does not iterate through them or link them, the macro may only apply the update to the final section's footer.
How do I ensure the first page footer is different using VBA?
You must set the 'PageSetup.DifferentFirstPageHeaderFooter' property to True. This applies to both headers and footers in the specified section, allowing you to modify the primary footer without affecting the first page.
Can I insert a Building Block into a footer via VBA?
Yes, you can use the 'BuildingBlocks.Insert' method in your VBA script to place a saved Building Block into the specified footer range of your target sections.




