Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How not to count page numbers for hidden slides in PPT?

In presentation mode, I want only unhidden slides to appear with consecutive page numbers. How can I avoid that hidden slides are counted?

like image 279
Maximilian Kohl Avatar asked Oct 14 '14 13:10

Maximilian Kohl


People also ask

How do I turn off automatic page numbering in PowerPoint?

Remove slide numbers from your presentationOn the Insert tab, select Slide Number. On the Slide tab, clear the box named Slide number.

When a slide is hidden from presentation What does it have over the number?

The hidden slide will have parentheses around the slide number. When you show a Hidden Slide and then click or press the spacebar to advance to the next slide in the sequence, it will jump to your next “real” slide, not the next Hidden Slide (even if one happened to be next).

How do I control slide numbers in PowerPoint?

On the Design tab, in the Customize group, click Slide Size, and then click Custom Slide Size. In the Slide Size dialog box, in the Number slides from box, enter the number that you want to show on the first slide in your presentation, and then click OK.


1 Answers

Thank you Steve. I found an answer to my question elsewhere. The function below allows you to avoid that hidden slides are interfering with the slide numbers of unhidden slides in presentation mode.

Sub Number_NonHidden()
'For v.2007 onwards only
Dim osld As Slide
Dim objSN As Shape
Dim lngNum As Long
'check all slides
For Each osld In ActivePresentation.Slides
'Is it hidden
If osld.SlideShowTransition.Hidden Then
osld.HeadersFooters.SlideNumber.Visible = False
Else
osld.HeadersFooters.SlideNumber.Visible = True
Set objSN = getNumber(osld)
lngNum = lngNum + 1
If Not objSN Is Nothing Then ' there is a number placeholder
objSN.TextFrame.TextRange = CStr(lngNum + 1)
End If
End If
Next osld
End Sub

Function getNumber(thisSlide As Slide) As Shape
For Each getNumber In thisSlide.Shapes
If getNumber.Type = msoPlaceholder Then
If getNumber.PlaceholderFormat.Type = ppPlaceholderSlideNumber Then
'it's the slide number
Exit Function
End If
End If
Next getNumber
End Function

In order to avoid that the title slide is numbered insert lngNum = -1 as follows and delete the slide number box in the master title slide.

'check all slides
lngNum = -1
For Each osld In ActivePresentation.Slides
like image 152
Maximilian Kohl Avatar answered Sep 27 '22 19:09

Maximilian Kohl