HeaderFooter.Index Property

Word Developer Reference

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.

Visual Basic for Applications
  Sub ChangeFirstPageFooter()
    Dim hdrFirstPage As HeaderFooter
Set hdrFirstPage = ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage)

If hdrFirstPage.<strong class="bterm">Index</strong> = 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