Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

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.


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Custom numbering a presentation
http://www.pptfaq.com/FAQ01282-Custom-numbering-a-presentation.htm
Last update 15 December, 2019
Created: 14 December, 2019