HeaderFooter.Exists property (Word)

True if the specified HeaderFooter object exists. Read/write Boolean.

Syntax

expression. Exists

expression A variable that represents a 'HeaderFooter' object.

Remarks

The primary header and footer exist in all new documents by default. Use this method to determine whether a first-page or odd-page header or footer exists. You can also use the DifferentFirstPageHeaderFooter or OddAndEvenPagesHeaderFooter property to return or set the number of headers and footers in the specified document or section.

Example

If a first-page header exists in section one, this example sets the text for the header.

Dim secTemp As Section 
 
Set secTemp = ActiveDocument.Sections(1) 
If secTemp.Headers(wdHeaderFooterFirstPage).Exists = True Then 
 secTemp.Headers(wdHeaderFooterFirstPage).Range.Text = _ 
 "First Page" 
End If

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.