Saturday, October 17, 2026

 Here's a VBA script for PowerPoint that counts the total number of slides in a presentation and places that count into a shape named "SlideTotal". Great for <#> out of so one can know how many slides are left. Why this isn't built into PowerPoint is beyond me. 

Sub UpdateSlideTotal()

    Dim totalBox As Shape
    Dim total As String

    total = CStr(ActivePresentation.Slides.Count)

    On Error Resume Next
    Set totalBox = ActivePresentation.SlideMaster.Shapes("SlideTotal")
    On Error GoTo 0

    If totalBox Is Nothing Then
        MsgBox "Could not find a shape named SlideTotal."
        Exit Sub
    End If

    totalBox.TextFrame.TextRange.Text = total

End Sub