The following works fine, assuming the slides already have a footer
defined through the master:
For Each s In ActivePresentation.Slides
s.DisplayMasterShapes = True
s.HeadersFooters.Footer.Visible = msoTrue
s.HeadersFooters.Footer.Text = [value I want to insert]
Next
However, if there is no footer area in the presentation, I get an
error:
HeaderFooter (unknown member): Invalid request
So my question is, is there are way to create a footer area in the
presentation via VBA? This needs to handle ppt 2007 and older file
versions.
Thanks
This should get you there for 2007; a bit of adjustment might be needed
for 2003 and prior:
Dim s As Slide
Dim oSh As Shape
For Each s In ActivePresentation.Slides
' we're going to try to get a reference to the
' footer shape and trap the error that occurs
' if it's not present:
On Error Resume Next
Set oSh = s.HeadersFooters.Footer
If Err.Number <> 0 Then
' no footer; add one to the master:
' adjust coordinates as needed
Call s.Master.Shapes.AddPlaceholder(ppPlaceholderFooter, _
0, 0, 500, 50)
End If
On Error GoTo 0
' now it should be safe to add etxt
s.HeadersFooters.Footer.Visible = msoTrue
s.HeadersFooters.Footer.Text = "woob woob"
Next
>
> The following works fine, assuming the slides already have a footer
> defined through the master:
>
> For Each s In ActivePresentation.Slides
> s.DisplayMasterShapes = True
> s.HeadersFooters.Footer.Visible = msoTrue
> s.HeadersFooters.Footer.Text = [value I want to insert]
> Next
>
> However, if there is no footer area in the presentation, I get an
> error:
> HeaderFooter (unknown member): Invalid request
>
> So my question is, is there are way to create a footer area in the
> presentation via VBA? This needs to handle ppt 2007 and older file
> versions.
>
> Thanks
==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/
PPTools add-ins for PowerPoint
http://www.pptools.com/
Thanks, this worked great! Only had to change the top and left
coordinates to 400, 550 so as to get bottom center position for the
footer.
Great ... glad to hear it.