HeaderFooter object (Excel)
Represents a single header or footer. The HeaderFooter object is a member of the HeadersFooters collection.
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 of the PageSetup object to specify a different first page.
Example
The following example adds the date and time to the center header on the active worksheet.
With ActiveSheet.PageSetup
.CenterHeader = "&D&T"
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
End With
Properties
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for