Selection.HeaderFooter Property (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a HeaderFooter object for the specified selection. Read-only.

expression .HeaderFooter

expression A variable that represents a Selection object.

An error occurs if the selection isn't located within a header or footer.

This example adds a centered page number to the current page footer.

With ActiveDocument.ActiveWindow.View 
 .Type = wdPrintView 
 .SeekView = wdSeekCurrentPageFooter 
End With 
Selection.HeaderFooter.PageNumbers.Add _ 
 PageNumberAlignment:=wdAlignPageNumberCenter
Show: