HeaderFooter Object [Publisher 2003 VBA Language Reference]
Page HeaderFooter TextRange |
Represents the header or footer of a master page.
Using the HeaderFooter Object
Use MasterPages.Header or MasterPages.Footer to return a HeaderFooter object. 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"
Use HeaderFooter.Delete to delete any existing content from a header or footer. Calling this method does not delete the text frame, just the contents of it. The following example deletes all of 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
Use HeaderFooter.TextRange to return a TextRange object representing the header or footer of a master page. Any header or footer content manipulation is done with through this property of the HeaderFooter object. 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
Properties | Application Property | IsHeader Property | Parent Property | TextRange Property
Methods | Delete Method
Parent Objects | Page Object
Child Objects | TextRange Object