Difference between revisions of "Main Page/Stuff/PowerPoint Add-ins/pageXofY code"

From phurvitz
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
Put this in a module.
 +
See an addin: [http://gis.washington.edu/phurvitz/phd/presentations/pageXofY.ppam pageXofY.ppam]
 
<source lang="vb">
 
<source lang="vb">
 
Sub UpdateFooter()
 
Sub UpdateFooter()

Latest revision as of 00:40, 6 March 2009

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>