HeaderFooter.IsHeader property (Publisher)

True if the specified HeaderFooter object is a header; False if it is a footer. Read-only Boolean.

Syntax

expression.IsHeader

expression A variable that represents a HeaderFooter object.

Return value

Boolean

Example

The following example creates a new collection and fills it with the header and footer from each master page. The collection is then iterated and a test is made to determine whether the HeaderFooter object is a header or a footer, and then appropriate text is written to the header or footer.

Dim objHeadersFooters As Collection 
Dim objMasterPage As page 
Dim objHeadFoot As HeaderFooter 
 
Set objHeadersFooters = New Collection 
For Each objMasterPage In ActiveDocument.masterPages 
 objHeadersFooters.Add objMasterPage.Header 
 objHeadersFooters.Add objMasterPage.Footer 
Next objMasterPage 
 
For Each objHeadFoot In objHeadersFooters 
 If objHeadFoot.IsHeader = True Then 
 objHeadFoot.TextRange.Text = "Header Text" 
 ElseIf objHeadFoot.IsHeader = False Then 
 objHeadFoot.TextRange.Text = "Footer Text" 
 End If 
Next 

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.