VBA & Macro Problems

How to Use VBA to Update Word Footers on Every Page Except the First

John WilsonJohn Wilson Nov 3, 2026 869 views

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.

How to Use VBA to Update Word Footers on Every Page Except the First
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press ALT + F11 to open the Visual Basic for Applications (VBA) editor and locate the macro you are working on.

2
Enable Different First Page

Ensure that your code sets 'ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True' so the first page remains unaffected by subsequent footer changes.

3
Iterate Through Sections

Use a 'For' loop to iterate from Section 2 to the end of the document (e.g., 'For i = 2 To ActiveDocument.Sections.Count').

4
Set LinkToPrevious to True

Inside the loop, apply 'ActiveDocument.Sections(i).Footers(wdHeaderFooterPrimary).LinkToPrevious = True' to link the footers across all subsequent sections.

Link Footers to Previous Sections via VBA
Efficient Updates: Linking footers is the most efficient method because it allows you to update the footer text just once in Section 2, and Word will automatically cascade the change to the rest of the document.
Advanced Formatting Made Easy

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. 1. Open Your Document: Launch WPS Writer and open your macro-enabled document.
  2. 2. Access Header and Footer Settings: Navigate to the 'Insert' tab and click on 'Header and Footer' to open the dedicated editing ribbon.
  3. 3. Apply Section Settings: Check the 'Different First Page' option from the ribbon to isolate your first page without writing any VBA code.
  4. 4. Run Your Macros: Go to the 'Developer' tab to access the VBA Editor and execute your macro to apply batch changes instantly.
Native compatibility with Microsoft Word document formats (.docx, .doc, .docm).Built-in VBA editor to run, edit, and debug macro scripts seamlessly.Intuitive graphical interface for managing document sections and 'Different First Page' settings visually.Lightweight installation ensures fast performance even with complex macro-enabled documents.
microsoft office alternative - wps office

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.