Main Page/Stuff/PowerPoint Add-ins/pageXofY code

From phurvitz
< Main Page‎ | Stuff‎ | PowerPoint Add-ins
Revision as of 00:40, 6 March 2009 by Phil Hurvitz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Put this in a module. See an addin: pageXofY.ppam <source lang="vb"> Sub UpdateFooter()

' Macro to add "X of Y" (page numbers) to each slide's footer. Dim Name As String Dim ocust As CustomLayout Dim odes As Design Dim osld As Slide Dim varNumberPages As Integer Dim pageNum As Integer varNumberPages = ActivePresentation.Slides.Count

Debug.Print (varNumberPages)


Name = ActivePresentation.Name

For Each odes In ActivePresentation.Designs

With odes.SlideMaster.HeadersFooters.Footer .Visible = msoTrue .Text = varNumberPages End With

For Each ocust In odes.SlideMaster.CustomLayouts

With ocust.HeadersFooters.Footer .Visible = msoTrue .Text = varNumberPages End With Next ocust Next odes

' Updates the individual slides that do not follow the master.

For Each osld In ActivePresentation.Slides With osld.HeadersFooters.Footer pageNum = osld.SlideNumber .Visible = msoTrue .Text = pageNum & " of " & varNumberPages End With Next osld

End Sub </source>