HeaderFooter object (Publisher)

Represents the header or footer of a master page.

Remarks

Use Page.Header or Page.Footer to return a HeaderFooter object.

Use the Delete method to delete any existing content from a header or footer. Calling this method does not delete the text frame, just the contents of it.

Use the TextRange property to return a TextRange object representing the header or footer of a master page. Any header or footer content manipulation is done by using this property of the HeaderFooter object.

Example

The following example adds text to the header of the first master page of the active document.

Dim objHeader As HeaderFooter 
Set objHeader = ActiveDocument.MasterPages(1).Header 
objHeader.TextRange.Text = "Master Page 1 Header" 


The following example deletes all the header and footer content of all the master pages in a publication.

Dim objMasterPage As page 
For Each objMasterPage In ActiveDocument.masterPages 
 objMasterPage.Header.Delete 
 objMasterPage.Footer.Delete 
Next

The following example first deletes any existing content and then adds some boilerplate text to the header of a master page.

Dim objHeader As HeaderFooter 
Set objHeader = ActiveDocument.MasterPages(1).Header 
With objHeader 
 .Delete 
 .TextRange.Text = "<Insert Address Here>" 
End With

Methods

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.