PowerPoint 2010 - How to get CURRENT and TOTAL number of pages in the file to appear in the footer

I'd like to have my PowerPoint footer say:
Page (current page) of (total pages in file) so...
Page 1 of 20
Page 2 of 20
Page 3 of 20
How can I do this?
Who is Participating?
Unfortunately you can't really do that in PPT. I suppose you can with code, but barring that, add a textbox that says Page <space space space> of 20  and in the <space space space> part, use Insert | Slide Number. This will update the current slide number, but not the total number of slides. You have to manually input the total number of slides.

This textbox on the master is different from a footer in that you cannot turn it on or off using Insert | Header and Footer. In this case, it's just always there.

To do this in the footer, your best bet is to put the "Page" and "of 20" parts in textboxes and then use the footer for the slide number because, while you used to be able to type the extra text into a footer, in more recent versions of PPT, that doesn't work.
Jamie GarrochPowerPoint Consultant & DeveloperCommented:
Echo is right (she always is!). You can automate the current slide number but not the total as per this Microsoft article:


If you want to do it by code, you could add a VBA macro but then you'd have to save the deck as a .pptm file unless you didn't need the code to travel with the file. If you're happy to use code, let me know and I'll write a macro for you.
brothertruffle880Author Commented:
GREAT help from both of you.
LOL, Jamie, you are so funny. I could say the same for you!

(Honestly, I'm just soooooo glad you code geeks are here to help people do the stuff I can't help them do manually!)
Jamie GarrochPowerPoint Consultant & DeveloperCommented:
Geeks. lol. Can't live with 'em, can't live without 'em!

So, After playing with some code, I realised this slide number placeholder has some interesting behaviour. It doesn't appear possible to programmatically change the text to "Page <#> of <slidecount>" whilst maintaining the dynamic <#> reference. So the following macro is a hard overwrite and requires it to be run if the slide order or number of slides changes.

' PowerPoint VBA Macro to update slide number text in slides where this placeholder is visible.
' Written By : Jamie Garroch of YOUpresent Ltd. http://youpresent.co.uk/
' Date : 21NOV2016
' Notes : this replaces the dynamic ‹#› field in the slide master with fixed text
'         so if you delete, add, move slides, you'll need to run this macro again
'         to update the text in the slide number placeholder.
Sub SetFooterText()
  Dim oSld As Slide
  Dim oShp As Shape
  For Each oSld In ActivePresentation.Slides
    For Each oShp In oSld.Shapes
      If oShp.Type = msoPlaceholder Then
        If oShp.PlaceholderFormat.Type = ppPlaceholderSlideNumber Then
          oShp.TextFrame.TextRange.Text = "Page " & oSld.SlideIndex & " of " & ActivePresentation.Slides.Count
        End If
      End If
End Sub

Open in new window

The actual slide number has its own special properties but the only one accessible via the OM (Object Model) is the visible one e.g.

ActivePresentation.Slides(1).HeadersFooters.SlideNumber.Visible = msoFalse

Open in new window

Although IntelliSense indicates that this has a .Text property, it doesn't.

An alternative method to maintain the dynamic <#> field would be to leave that unchanged on the slide master and add two new text boxes either side of it so the one on the left contains "Page" and the one on the right contains "X" where X is the number of slides in your deck. You could then write a macro to update that value but since it's only in one place, it seems easier to just remember to do it manually.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.