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

From phurvitz
Jump to: navigation, search
(New page: <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 ...)
 
Line 43: Line 43:
  
 
End Sub
 
End Sub
<source>
+
</source>

Revision as of 00:27, 6 March 2009

<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>