Compartilhar via


HeaderFooter.Exists Property

Word Developer Reference

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.

Visual Basic for Applications
  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