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.

Add shape with text to "flag" hidden vs unhidden slides

Problem

A presenter uses hidden slides and regular slides in a presentation. The hidden slides are part of a printed guide but not part of the actual presentation.

The presenter wants to print handouts that distinguish which slides are part of the presentation and which are not.

Solution

The following FlagSlides macro will add a colored rectangle in the upper right hand corner of each slide. Its color and text will depend on whether the slide is hidden or not.

You can modify the rectangle position, size, color and text characteristics to suit your needs.

The UnFlagSlides macro will remove the flag shapes that FlagSlides added.


Sub FlagSlides()

Dim oSlides As Slides
Dim oSld As Slide

Set oSlides = ActivePresentation.Slides
For Each oSld In oSlides
    If oSld.SlideShowTransition.Hidden Then
        ' Add a flag shape
        With oSld.Shapes.AddShape(msoShapeRectangle, 564#, 0#, 156#, 78#)
            ' give it a name so we can delete or hide it easily later
            .Name = "HIDDEN"

            ' Change this to whatever you like
            With .TextFrame.TextRange
                .Text = "HIDDEN SLIDE"
                With .Font
                    '.Name = "Times New Roman"
                    .Size = 14
                    .Bold = msoTrue
                    .Color.RGB = RGB(255, 255, 255)
                End With
            End With ' text frame
            .Fill.ForeColor.RGB = RGB(255, 0, 0)
        End With  ' newly added shape
    Else    ' it's NOT hidden so
        ' Add a flag shape
        With oSld.Shapes.AddShape(msoShapeRectangle, 564#, 0#, 156#, 78#)
            ' give it a name so we can delete or hide it easily later
            .Name = "NOT_HIDDEN"

            ' Change this to whatever you like
            With .TextFrame.TextRange
                .Text = "NOT HIDDEN SLIDE"
                With .Font
                    '.Name = "Times New Roman"
                    .Size = 14
                    .Bold = msoFalse
                    .Color.RGB = RGB(255, 255, 255)
                End With
            End With ' text frame
            .Fill.ForeColor.RGB = RGB(0, 0, 255)
            .Fill.Visible = msoTrue
            .Fill.Solid
        End With  ' newly added shape

    End If

Next oSld

End Sub

Sub UNFlagSlides()

Dim oSlides As Slides
Dim oSld As Slide

Set oSlides = ActivePresentation.Slides
On Error Resume Next ' in case user has deleted the "flag" shapes
For Each oSld In oSlides
    If oSld.SlideShowTransition.Hidden Then
        oSld.Shapes("HIDDEN").Delete
    Else    ' it's NOT hidden so
        oSld.Shapes("NOT_HIDDEN").Delete
    End If
Next oSld

End Sub

See How do I use VBA code in PowerPoint? to learn how to use this example code.

Search terms:


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

Add shape with text to "flag" hidden vs unhidden slides
http://www.pptfaq.com/FAQ00419_Add_shape_with_text_to_-flag-_hidden_vs_unhidden_slides.htm
Last update 07 June, 2011
Created: