PPT 2007 VBA - How to have a change to footer in slide master applyto all slides?


T

tangotom

I have a large PPT 2007 presentation that was put together without
using a master. I now want to add a custom footer using vba. I can
come close using code from a PPT 2003 macro, but the "apply to all
slides" part in the 2003 code doesn't work in PPT 2007. Here is the
2003 code that comes close:

If ActivePresentation.HasTitleMaster Then
With ActivePresentation.TitleMaster.HeadersFooters
With .DateAndTime
.Format = ppDateTimeMdyy
.Text = "CONFIDENTIAL"
.UseFormat = msoFalse
.Visible = msoTrue
End With
With .Footer
.Text = "my custom text"
.Visible = msoTrue
End With
.SlideNumber.Visible = msoTrue
End With
End If

With ActivePresentation.SlideMaster.HeadersFooters
With .DateAndTime
.Format = ppDateTimeMdyy
.Text = "CONFIDENTIAL"
.UseFormat = msoFalse
.Visible = msoTrue
End With
With .Footer
.Text = "my custom text"
.Visible = msoTrue
End With
.SlideNumber.Visible = msoTrue
.DisplayOnTitleSlide = msoFalse
End With

With ActivePresentation.Slides.Range.HeadersFooters
With .DateAndTime
.Format = ppDateTimeMdyy
.Text = "CONFIDENTIAL"
.UseFormat = msoFalse
.Visible = msoTrue
End With
With .Footer
.Text = "my custom text"
.Visible = msoTrue
End With
.SlideNumber.Visible = msoTrue
End With

It is that last chunk of code that should do the work of applying the
edits made to Title Master and Slide Master to all the slides.
Unfortunately, the first line of that chunk generates an error in PPT
2007.

Can someone please let me know what the correct object syntax would
be?

Thanks.
 
Ad

Advertisements

T

tangotom

It's always a good idea to quote the *exact* text of the error message.
In this case, there are two problems:

You can only work with .HeadersFooters on a perslidebasis
You can'tchangethe text properties until you've made the text visible
 (which strikes me as a critter with many legs, but it's what it is)

Changed thus it'll work:

    ' Work with eachslideindividually, not ranges:
    Dim oSld AsSlide
    For Each oSld In ActivePresentation.Slides
        With oSld.HeadersFooters

            With .DateAndTime
               ' Make it visible, thenchangeit
                .Visible = msoTrue
                .Text = "CONFIDENTIAL"
                .Format = ppDateTimeMdyy
                .UseFormat = msoFalse

            End With

            With .Footer
                .Visible = msoTrue
                .Text = "my custom text"

            End With
            .SlideNumber.Visible = msoTrue
        End With
    Next    'slide

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USAwww.pptlive.com- Hide quoted text -

- Show quoted text -

Steve,

Thanks for your response. I had done it with the per slide method,
but it was taking a long time with a presentation of 1,000 slides.
So, I thought a "quick" change to the master would do the trick.

The procedure of making the text visible first before making changes
is new to me, and absolutely helpful. Thank you.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top