HeaderFooter.Index property (Word)

Returns a WdHeaderFooterIndex that represents the specified header or footer in a document or section. Read-only.

Syntax

expression.Index

expression Required. A variable that represents a 'HeaderFooter' object.

Example

This example adds a shape to the first page header in the active document if the specified variable references the first page header.

Sub ChangeFirstPageFooter() 
 Dim hdrFirstPage As HeaderFooter 
 
 Set hdrFirstPage = ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage) 
 
 If hdrFirstPage.Index = wdHeaderFooterFirstPage Then 
 With hdrFirstPage.Shapes.AddShape(Type:=msoShapeHeart, _ 
 Left:=36, Top:=36, Width:=36, Height:=36) 
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0) 
 End With 
 End If 
 
End Sub

See also

HeaderFooter Object

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.