Version Information
Version Added: Excel

Remarks

You can also return a single HeaderFooter object by using the HeaderFooter property with a Selection object.

Note
You cannot add HeaderFooter objects to the HeadersFooters collection.

Use the DifferentFirstPageHeaderFooter property with the PageSetup object to specify a different first page.

Use the OddAndEvenPagesHeaderFooter property with the PageSetup object to specify different odd and even page headers and footers. If the OddAndEvenPagesHeaderFooter property is True, you can return an odd header or footer by using wdHeaderFooterPrimary, and you can return an even header or footer by using wdHeaderFooterEvenPages.

Example

Use the Add method with the PageNumbers object to add a page number to a header or footer. The following example adds page numbers to the primary footer in the first section of the active workbook.

Visual Basic for Applications
With ActiveWorksheet.Sections(1) .Footers(wdHeaderFooterPrimary).PageNumbers.Add End With

See also: