Section.Headers property (Word)

Returns a HeadersFooters collection that represents the headers for the specified section. Read-only.

Syntax

expression. Headers

expression A variable that represents a 'Section' object.

Remarks

For information about returning a single member of a collection, see Returning an object from a collection. To return a HeadersFooters collection that represents the footers for the specified section, use the Footers property.

Example

This example adds centered page numbers to every page in the active document except the first. (A separate header is created for the first page.)

With ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) 
 .PageNumbers.Add _ 
 PageNumberAlignment:=wdAlignPageNumberCenter, _ 
 FirstPage:=False 
End With

This example adds text to the first-page header in the active document.

ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True 
With ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage) 
 .Range.InsertAfter("First Page Text") 
 .Range.Paragraphs.Alignment = wdAlignParagraphRight 
End With

See also

Section Object

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.