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: EricWhite.com/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 = ""
Next
objPresentation.Save
objPresentation.Close
End If
Next
MsgBox ("Done")
End Sub
This was from a Scripting Guy column, but was missing the On Error Resume Next.