Page.Header property (Publisher)

Returns a HeaderFooter object representing the header of the specified Page object. Read-only.

Syntax

expression.Header

expression A variable that represents a Page object.

Return value

HeaderFooter

Remarks

This property is only for master pages. A "This feature is only for master pages" error is returned if the header property is accessed from a Page object that is returned form the Pages collection.

A new HeaderFooter object is created for the specified master page by accessing this property.

Example

The following example creates a HeaderFooter object and sets it to the header of the first master page.

Dim objHeader As HeaderFooter 
Set objHeader = ActiveDocument.MasterPages(1).Header

The HeaderFooter object returned by the Header property can be used to manipulate the header content. The following example sets some properties of the HeaderFooter object of the first master page.

With ActiveDocument.masterPages(1) 
 With .Header 
 .TextRange.Text = "Windows" & Chr(13) & "Office" & Chr(13) & "Internet Explorer" 
 With .TextRange.ParagraphFormat 
 .SetListType Value:=pbListTypeBullet, BulletText:="*" 
 .Alignment = pbParagraphAlignmentLeft 
 End With 
 End With 
 With .Footer 
 .TextRange.Hyperlinks.Add Text:=.TextRange, _ 
 Address:="https://www.tailspintoys.com", _ 
 TextToDisplay:="Tailspin" 
 End With 
End With

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.