From: tangotom on
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.
From: tangotom on
On Aug 16, 12:58 pm, Steve Rindsberg <ab...(a)localhost.com> wrote:
> In article <dfe276c0-0b38-4aaf-8815-af70636f5...(a)m45g2000hsb.googlegroups..com>,
>
>
>
>
>
> Tangotom wrote:
> > Ihavea large PPT 2007 presentation that was put together without
> > using amaster.  I now want to add a customfooterusing vba.  I can
> > come close using code from a PPT 2003 macro, but the "applytoall
> >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 TitleMasterandSlideMastertoalltheslides.
> > Unfortunately, the first line of that chunk generates an error in PPT
> > 2007.
>
> 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
 | 
Pages: 1
Prev: scripts and LiveWeb
Next: Org Charts