Current Header and Footer Text

  • Thread starter Jeffrey Bradshaw
  • Start date
J

Jeffrey Bradshaw

Is there a way to find out what the text is in the header and footer for the
page you are currently on?

TIA - Jeffrey.
 
J

Jonathan West

Hi Jeffrey

The code above returns the text of the three possible headers for the
current section. If you don't have separate odd-even headers, and don't have
a separate first page header, then you only use the first one.

strHeaderMain =
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text
strHeaderEven =
Selection.Sections(1).Headers(wdHeaderFooterEvenPages).Range.Text
strHeaderFirst =
Selection.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Text
 
Top