Microsoft

Display the slideshow name on all your PowerPoint slides

Use this simple VBA macro to display your presentation's name on all your PowerPoint slides.

Many presentations don't require VBA solutions. In fact, you can create presentations and never use VBA at all. Occasionally, however, you run into something PowerPoint can't do on its own. For instance, there's no built-in method for displaying the slide show name on a slide (or all slides). For that, you can use the simple macro that follows:

Sub SlideShowName()
  'Add a text box to display name of slide show.
  Dim sld As Slide
  Dim shp As Shape
  For Each sld In ActivePresentation.Slides
    For Each shp In sld.Shapes
      If Left(shp.Name, 6) = "Footer" Then
         shp.TextFrame.TextRange.Text = ActivePresentation.FullName
      End If
    Next
  Next
End Sub

The biggest decision when using this macro isn't the macro but rather, how to call it. Rather than slant you one way or another, I'll use the simplest method-a bit later. For now, take a second to review the macro. The code cycles through all the shapes on each slide in the presentation. When the code encounters a shape that begins with the text "footer," it will display the slide show name in that shape. This route lets you choose which slides to display the name on by simply adding a footer. So, let's do that now:

  1. Click the Insert tab.
  2. Click Header & Footer in the Text group.
  3. In the resulting dialog, click the Footer option and click Apply To All. You can add the footer to individual slides or a group of slides, rather than all-it just depends on your needs.

Once the footers are in place, add the sub procedure as follows:

  1. Press [Alt]+[F11] to launch the Visual Basic Editor (VBE).
  2. Click Module on the Insert menu.
  3. In the resulting module, enter the procedure above.
  4. Save the presentation as a macro-enabled presentation (.pptm).

At this point, you're ready to run the macro:

  1. Click the Developer tab.
  2. Click the Macros option in the Code group.
  3. In the resulting dialog, select the SlideShowName() macro and click Run.

Every slide with a footer will display the slide show name. There are other ways to execute macros, but this is the simplest. When applying the macro to your own presentations, you might want to use a different trigger. In addition, this macro isn't dynamic. If you change the name of the presentation file, you'll have to remember to rerun the macro.

About

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

4 comments
pptcrafter
pptcrafter

it's gratifying to see that we all know the right way - too bad the clients don't...

rae.drysdale
rae.drysdale

I would recommend avoiding the use of anything that adds clutter to slides - no logos, slide numbers, footers etc. The audience doesn't need them.

ssharkins
ssharkins

You know, clients want what they want. This one had a reason for it -- I supplied the simple solution. :)

kitedemon
kitedemon

I agree with Rae; the less clutter the better. Having said that though, slide numbers are minimal clutter and provide the audience with a valuable reference as an identifier for discussion by e-mail later as in; "on slide 6 of yeterday's PowerPoint presentation, you noted that..."

Editor's Picks