Custom numbering a presentation
Problem
Sometimes we need to start slide numbering with some number other than 1. PowerPoint lets us start with whatever number we like, but it always starts numbering on the first slide.
But what if the first couple slides are title pages, tables of contents or other such material like you'd find at the beginning of a textbook? And what if you want the slide numbering to start on the fourth slide?
PowerPoint won't do this for you. But with a bit of VBA, you can make it happen.
Solution
This macro will number your slides starting with whatever slide you choose, and beginning with whatever number you choose (you'll need to edit the macro where indicated). If you add or remove slides later, you'll need to run the macro again; it'll automatically delete its previously added numbers and add new, corrected ones.
Sub CustomNumberSlides()
Dim oSl As Slide
Dim oSh As Shape
Dim x As Long
Dim oNumber As Shape
Dim lStartNumberingOn As Long
Dim lStartingNumber As Long
Dim sFormat as String
' EDIT THESE TO SUIT YOUR NEEDS:
' What slide should the numbering start ON
lStartNumberingOn = 4
' What should the first slide number BE
lStartingNumber = 4
' How should the number be displayed
sFormat = "000" ' three digits, add leading zeros
' First, delete any previous numbers
' created by this macro:
For Each oSl In ActivePresentation.Slides
For x = oSl.Shapes.Count To 1 Step -1
If oSl.Shapes(x).Tags("MyNumber") = "Y" Then
oSl.Shapes(x).Delete
End If
Next
Next
' Now add new slide numbers:
For x = lStartNumberingOn To ActivePresentation.Slides.Count
Set oSl = ActivePresentation.Slides(x)
With oSl.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, 0, 50, 20)
' Add a tag so we can find and delete the number later
.Tags.Add "MyNumber", "Y"
' Set the text of the number
.TextFrame.TextRange.Text = Format(lStartingNumber, sFormat)
' Edit these to change the position of the number
.Left = 20
.Height = 20
.Top = 500
.Width = 50
' Edit these to change the formatting of the number
With .TextFrame.TextRange.Font
.Size = 12
.Color.RGB = RGB(255, 0, 0)
End With
End With
lStartingNumber = lStartingNumber + 1
Next
End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.