PowerPoint Macro: Removing Speaker Notes

Sometimes I want to remove all the speaker notes from a presentation file.
This PowerPoint VBA macro allows us to remove all the speaker notes from an active presentation file.

Macro Example

Sub RemoveAllSpeakerNotes()

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides
    sld.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange _
    = ""
  Next sld

End Sub

Description

Variable Declaration

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

Sub...

  Dim sld As Slide

The Slide object represent a single 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

The Application.ActivePresentation property returns the 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

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

Removeing a Speaker Note

The 6th-7th line remove the strings of each slide speaker note.

Sub...

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides
    sld.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange _
    = ""

This object model hierarchy is very deep.
I will explain about this.

Slide.NotesPage

The Slide.NotesPage property (sld.NotesPage) returns a SlideRange object that represents the notes pages for the slide.

    sld.NotesPage...

obj-PowerPoint-Slide-NotePage

SlideRange.Shapes

The SlideRange.Shapes property (.NotesPage.Shapes) returns a Shapes collection object.

    sld.NotesPage.Shapes...

obj-PowerPoint-SlideRange-Shapes

Shapes.Placeholders

The Shapes.Placeholders property (.Shapes.Placeholders) returns a Placeholders collection object.

    sld.NotesPage.Shapes.Placeholders...

obj-PowerPoint-Shapes-Placeholders

Placeholders.Item

The Placeholders.Item method (.Placeholders(2)) returns a single Shape object from a Placeholders collection.

    sld.NotesPage.Shapes.Placeholders(2)...

obj-PowerPoint-Placeholders-Item

Because the .Item method is a default member of the Placeholders collection object, we can omit the .Item.
So, the .Placeholders(2) is equal .Placeholders.Item(2).
And the Placeholders(2) returns the Shape object of a speaker note.

Shape.TextFrame

The Shape.TextFrame property (.Placeholders(2).TextFrame) returns a TextFrame object.

    sld.NotesPage.Shapes.Placeholders(2).TextFrame...

obj-PowerPoint-Shape-TextFrame

TextFrame.TextRange

The TextFrame.TextRange property (.TextFrame.TextRange) returns a TextRange object.

    sld.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange...

obj-PowerPoint-TextFrame-TextTrange

Because the Text property is a default property of the TextRange object, we can omit the Text property.

obj-PowerPoint-TextTrange-Text

So, the .TextRange = “” is equal .TextRange.Text = “”.

So the 6th-7th line remove the strings of each slide speaker note.

    sld.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange _
    = ""

Loops Back to Get the Next Slide

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

Sub...

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides
    sld.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange _
    = ""
  Next sld

After every speaker note is removed, this macro ends.

Sub RemoveAllSpeakerNotes()

  Dim sld As Slide

  For Each sld In ActivePresentation.Slides
    sld.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange _
    = ""
  Next sld

End Sub

Properties

http://www.relief.jp/itnote/archives/001515.php

Apply to

  • PowerPoint 2013
  • PowerPoint 2010
  • PowerPoint 2007