PDA

View Full Version : Iterating through all slides - not working



Strider1977
10-05-2014, 08:19 AM
Hi everyone. I've searched and searched for code and found various examples but all seem to have the same problem... they stop iterating after a few slides. I am attempting to put the SlideID property into the footer. This will make it possible to assign unique IDs to each slide so that I can have several people review slides later.

My presentation is composed in PPT 2010 and uses Sections to divide slides. I suspect the code is stopping at the section divisions. Is there any way to make this continue all the way to the end regardless of what sections there are?

Many thanks,
Strider


Sub MakeUIDs()
Debug.Print ("test")
Dim sld As Slide
For Each sld In ActivePresentation.Slides
Debug.Print "Slide " & sld.SlideID
sld.HeadersFooters.Footer.Text = "ID: " & ActivePresentation.Slides(i).SlideID
Next sld
End Sub

John Wilson
10-05-2014, 12:44 PM
There are two problems.

1) In your code i is always zero and there is no slide zero. In any case it is not needed see below
2) Footers will only change if you have enebled them or make them visible

Try this:

Sub MakeUIDs()
Debug.Print ("test")
Dim sld As Slide
For Each sld In ActivePresentation.Slides
Debug.Print "Slide " & sld.SlideID
sld.HeadersFooters.Footer.Visible=msoTrue
sld.HeadersFooters.Footer.Text = "ID: " & sld.SlideID
Next sld
End Sub