Supercharge your PowerPoint productivity with

Supercharge your PPT Productivity with PPTools - Click here to learn more.

Tell me about PPTools

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


PPTools
Shape Styles brings the power of styles to PowerPoint. Apply complex formatting with a single click
Merge Excel, CSV or tab-delimited data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more
FixLinks prevents broken links when you distribute PowerPoint presentations
Optimizer saves disk space and bandwidth, shrinks your PowerPoint presentations to the right size for email, screenshow or printing
PPT2HTML gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements
Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF
Image Export converts PowerPoint slides to JPG, PNG, GIF, WMF and more

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:


Page copy protected against web site content infringement by Copyscape Contents © 1995-2008 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.

Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese



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.htm
Last update 09 September, 2006