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.

Show me the next unhidden slide

Problem

Sometimes you need to know what the next UNHIDDEN slide is rather than simply the next slide in the presentation.

Solution

The NextUnhiddenSlide Function below takes a single parameter, the index of the slide you want to start searching from, and returns the slide index of the next unhidden slide following it, or 0 if there are no unhidden slides following.

The TestMe Subroutine demonstrates how you'd use the function.

Function NextUnhiddenSlide(lStartingSlideIndex As Long) As Long
' Returns the next unhidden slide following the slide at lStartingSlideIndex

    Dim x As Long
    Dim oPres As Presentation

    Set oPres = ActivePresentation
    For x = lStartingSlideIndex + 1 To oPres.Slides.Count
        If Not oPres.Slides(x).SlideShowTransition.Hidden Then
            NextUnhiddenSlide = x
            Exit Function
        End If
    Next

End Function

Sub TestMe()
    Dim x As Long
    Dim y As Long

    For x = 1 To ActivePresentation.Slides.Count
        y = NextUnhiddenSlide(x)
        If y > 0 Then
            Debug.Print "Current slide:" & vbTab & x & vbTab & "Next unhidden:" & vbTab & y
        Else
            Debug.Print "Current slide:" & vbTab & x & vbTab & "Next unhidden:" & vbTab & "NONE"
        End If
    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

Show me the next unhidden slide
http://www.pptfaq.com/FAQ00876_Show_me_the_next_unhidden_slide.htm
Last update 07 June, 2011
Created: