Consulting

Results 1 to 11 of 11

Thread: add duplicate page numbers to notes pages

  1. #1
    VBAX Regular
    Joined
    Jul 2015
    Posts
    9
    Location

    add duplicate page numbers to notes pages

    I have a unique situation I think can only be solved with VBA code, but I'm just learning and I haven't been able to figure it out.

    I need to be able to add a page number to the notes page view of a slide, and then add the same page number to the next notes page, but with the letters FG preceding the number. The end result would look like this:
    Slide 1 = Notes page 1
    Slide 2 = Notes page FG1
    Slide 3 = Notes page 2
    Slide 4 = Notes page FG2

    (This is for training material where each page in the student guide has a corresponding facilitator guide page. I know PPT isn't the best application for this type of thing, but unfortunately, it's not my choice.)

    Anyway, is it possible to do this with VBA? I would greatly appreciate any advice!

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Try this then:

    Sub notepage()
    Dim osld As Slide
    Dim oNum As Shape
    Dim x As Long
    For Each osld In ActivePresentation.Slides
    For Each oNum In osld.NotesPage.Shapes
    If oNum.Type = msoPlaceholder Then
    If oNum.PlaceholderFormat.Type = ppPlaceholderSlideNumber Then
    If osld.SlideIndex / 2 = osld.SlideIndex \ 2 Then 'it's even do not increment
    oNum.TextFrame2.TextRange = "FG" & CStr(x)
    Else ' it's odd
    'increment number
    x = x + 1
    oNum.TextFrame2.TextRange = CStr(x)
    End If
    End If
    End If
    Next oNum
    Next osld
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Regular
    Joined
    Jul 2015
    Posts
    9
    Location

    add duplicate page numbers to notes pages

    Thanks for the quick reply! I tried the code you suggested, but it didn't seem to do anything. I'll play with it and see if I can figure out what I'm missing. Thanks for getting me started!

    Quote Originally Posted by John Wilson View Post
    Try this then:

    Sub notepage()
    Dim osld As Slide
    Dim oNum As Shape
    Dim x As Long
    For Each osld In ActivePresentation.Slides
    For Each oNum In osld.NotesPage.Shapes
    If oNum.Type = msoPlaceholder Then
    If oNum.PlaceholderFormat.Type = ppPlaceholderSlideNumber Then
    If osld.SlideIndex / 2 = osld.SlideIndex \ 2 Then 'it's even do not increment
    oNum.TextFrame2.TextRange = "FG" & CStr(x)
    Else ' it's odd
    'increment number
    x = x + 1
    oNum.TextFrame2.TextRange = CStr(x)
    End If
    End If
    End If
    Next oNum
    Next osld
    End Sub

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Did you have the slide number showing on notes pages before you ran the code?
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Regular
    Joined
    Jul 2015
    Posts
    9
    Location
    No, there are no slide numbers on the Notes pages.

  6. #6
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    That's the problem
    Either add them first In Note Page View
    INSERT > Tick Slide Number > Apply to all (This is best)

    OR you could try this which should do this in code (ONLY if there are NO numbers at all)

    Sub NotesFix()
    Dim osld As Slide
    Dim x As Long
    On Error Resume Next
    ActivePresentation.NotesMaster.Shapes.AddPlaceholder (ppPlaceholderSlideNumber)
    For Each osld In ActivePresentation.Slides
    With osld.NotesPage.Shapes.AddPlaceholder(ppPlaceholderSlideNumber)
    .TextFrame.TextRange.InsertSlideNumber
    If osld.SlideIndex / 2 = osld.SlideIndex \ 2 Then
    .TextFrame2.TextRange = "FG" & CStr(x)
    Else
    x = x + 1
    .TextFrame2.TextRange = CStr(x)
    End If
    End With
    Next osld
    End Sub
    Last edited by John Wilson; 07-22-2015 at 08:33 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  7. #7
    VBAX Regular
    Joined
    Jul 2015
    Posts
    9
    Location
    Perfect!! You're a genius! Thank you SO MUCH!!

  8. #8
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Pleasure.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  9. #9
    VBAX Regular
    Joined
    Jul 2015
    Posts
    9
    Location
    John,
    I hate to ask after all you've done already, but I've been asked to make the page numbering start on the second slide. Could I trouble you for help with that?

  10. #10
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    can you explain EXACTLY what you need but assuming you mean:

    eg Slide 2 Notes page =1
    Slide 3 Notes ="FG1"

    This should work (make sure numbers are visible before running)

    Sub notepage()
        Dim osld As Slide
        Dim oNum As Shape
        Dim x As Long
        For Each osld In ActivePresentation.Slides
            For Each oNum In osld.NotesPage.Shapes
                If oNum.Type = msoPlaceholder Then
                    If oNum.PlaceholderFormat.Type = ppPlaceholderSlideNumber Then
                        If osld.SlideIndex / 2 = osld.SlideIndex \ 2 Then 'it's even increment
                          x = x + 1
                            oNum.TextFrame2.TextRange = CStr(x)
                        Else ' it's odd ad "FG"
                            oNum.TextFrame2.TextRange = "FG" & CStr(x)
                        End If
                        'remove slide 1 number
                        If osld.SlideIndex = 1 Then oNum.Delete
                    End If
                End If
            Next oNum
        Next osld
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  11. #11
    VBAX Regular
    Joined
    Jul 2015
    Posts
    9
    Location
    Thank you, thank you, thank you! You're a lifesaver! I actually need it to be 0, FG1, 1, FG2, 2... but I was able to make the necessary change and it works beautifully! You're a wizard!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •