Removing Speaker Notes from a set of PowerPoint Presentations

Sometimes you want to prepare a set of PowerPoint presentations for distribution outside your company, and you want to remove all speaker notes from the presentations.  This is easy enough to do if you only need to scrub a few presentations, but if you have a lot, then manually scrubbing each one will be tedious.  Here is a bit of VBA code to iterate through all presentations (both PPT and PPTX) in a directory, removing the speaker notes from each slide in each deck.  Posting this so that I can find this script the next time I need it.

This blog is inactive.
New blog:

Blog TOC

Sub RemoveSpeakerNotes()

  Set objPPT = CreateObject("PowerPoint.Application")
  objPPT.Visible = True
  strComputer = "."
  Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2")
  Set FileList = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='E:DirectoryContainingPresentations'} Where " _
    & "ResultClass = CIM_DataFile")
  For Each objFile In FileList
    If objFile.Extension = "pptx" Or objFile.Extension = "ppt" Then
      Set objPresentation = objPPT.Presentations.Open(objFile.Name)
      Set colSlides = objPresentation.Slides
      On Error Resume Next
      For Each objSlide In colSlides
        objSlide.NotesPage.Shapes(2).TextFrame.TextRange = ""
    End If
  MsgBox ("Done")
End Sub

This was from a Scripting Guy column, but was missing the On Error Resume Next.

Comments (5)
  1. Truly of the Yard says:

    Thank you! This is just what I needed.

  2. Otaku says:

    Seems strange to have this on your blog. I like and use VBA, but come to this blog for very different reasons – I can get this kind of thing anywhere. OpenXML is what I come here for.

  3. Hi Otaku, problem is, I looked elsewhere, and this info wasn’t available.  Actually, first I wrote this as an Open XML program, but then because we were preparing presentations for wide distribution, decided to let PowerPoint do it.  And then there were several groups inside Microsoft who had the same need right now, so was posting this information here to save other folks lots of time.  But I still want to post the Open XML version once I validate it to my satisfaction.  🙂

    But I really appreciate that you come here for Open XML info – document formats are my passion, although Office development follows right behind.


  4. Otaku says:

    It’s actually easier than that for new 2007/2010 formats.

    Sub RemoveSpeakerNotes()

      Dim status As MsoDocInspectorStatus

      Dim results As String

      ActivePresentation.DocumentInspectors(4).Fix status, results

    End Sub

  5. Steve Rindsberg says:

    You can't count on the notes text placeholder being the second shape on the notes page.

    There's a more reliable way of getting the text placeholder here:

    Show me the Notes Text

Comments are closed.

Skip to main content