PowerPoint Macro: Unhiding All Slides

This PowerPoint VBA macro allows us to unhide or show all the slides in an active presentation file.

Macro Example

Sub UnhideAllSlides()

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides
    sld.SlideShowTransition.Hidden = msoFalse
  Next sld

End Sub

Description

Variable Declaration

The 3rd line declares an object variable called sld that represents a Slide object.

Sub...

  Dim sld As Slide

The Slide object represent a individual slide in a PowerPoint presentation.

obj-PowerPoint-Slide

Starts Looping

The 5th line starts to loop through all the elements (=Slide) of a collection (=Slides).

Sub...

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides

ActivePresentation property

  ...In ActivePresentation...

The Application.ActivePresentation property returns an active Presentation object.

obj-PowerPoint-Application-ActivePresentation

The ActivePresentation property is a member of the PowerPoint.Global class, so we can omit the Application property.

obj-PowerPoint-ActivePresentation

Presentation.Slides property

  ...In ActivePresentation.Slides

The Presentation.Slides property (ActivePresentation.Slides) returns a Slides collection object.

obj-PowerPoint-Presentation-Slides

The Slides object is a collection of all the Slide object in a presentation.
obj-PowerPoint-Slides

Shows the Slide

The 6th line unhides or shows the slide.

Sub...

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides
    sld.SlideShowTransition.Hidden = msoFalse

Slide.SlideShowTransition property

        sld.SlideShowTransition...

The Slide.SlideShowTransition property (sld.SlideShowTransition) returns a SlideShowTransition object that represents the special effects for the slide transition.

obj-PowerPoint-Slide-SlideShowTransition

SlideShowTransition.Hidden property

        sld.SlideShowTransition.Hidden...

The SlideShowTransition.Hidden property returns or sets the slide is hidden during a slide show.

obj-PowerPoint-SlideShowTransition-Hidden

So, the 6th line unhides or shows the slides by setting the SlideShowTransition.Hidden property to msoFalse.

        sld.SlideShowTransition.Hidden = msoFalse

Loops Back to Get the Next Slide

The 7th line loops back to get the next slide.

Sub...

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides
    sld.SlideShowTransition.Hidden = msoFalse
  Next sld

After every slide is unhidden, this macro ends.

Sub UnhideAllSlides()

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides
    sld.SlideShowTransition.Hidden = msoFalse
  Next sld

End Sub

Properties

http://www.relief.jp/itnote/archives/powerpoint-vba-hyde-odd-or-even-slides.php

Apply to

  • PowerPoint 2013
  • PowerPoint 2010
  • PowerPoint 2007