HeaderFooter Object

PowerPoint Developer Reference

Represents a header, footer, date and time, slide number, or page number on a slide or master. All the HeaderFooter objects for a slide or master are contained in a HeadersFooters object.

Remarks

Use one of the properties listed in the following table to return the HeaderFooter object.

Use this property To return
DateAndTime A HeaderFooter object that represents the date and time on the slide.
Footer A HeaderFooter object that represents the footer for the slide.
Header A HeaderFooter object that represents the header for the slide. This works only for notes pages and handouts, not for slides.
SlideNumber A HeaderFooter object that represent the slide number (on a slide) or page number (on a notes page or a handout).
Bb265521.vs_note(en-us,office.12).gif  Note
HeaderFooter objects aren't available for Slide objects that represent notes pages. The HeaderFooter object that represents a header is available only for a notes master or handout master.

Example

You can set properties of HeaderFooter objects for single slides. The following example sets the footer text for slide one in the active presentation.

Visual Basic for Applications
  ActivePresentation.Slides(1).HeadersFooters.Footer.Text = "Volcano Coffee"

You can also set properties of HeaderFooter objects for the slide master, title master, notes master, or handout master to affect all slides, title slides, notes pages, or handouts and outlines at the same time. The following example sets the text for the footer in the slide master for the active presentation, sets the format for the date and time, and turns on the display of slide numbers. These settings will apply to all slides that are based on this master that display master graphics and that have not had their footer and date and time set individually.

Visual Basic for Applications
  Set mySlidesHF = ActivePresentation.SlideMaster.HeadersFooters
With mySlidesHF
    .Footer.Visible = True
    .Footer.Text = "Regional Sales"
    .SlideNumber.Visible = True
    .DateAndTime.Visible = True
    .DateAndTime.UseFormat = True
    .DateAndTime.Format = ppDateTimeMdyy
End With

To clear header and footer information that has been set for individual slides and make sure all slides display the header and information you define for the slide master, run the following code before running the previous example.

Visual Basic for Applications
  For Each s In ActivePresentation.Slides
    s.DisplayMasterShapes = True
    s.HeadersFooters.Clear
Next

See Also