I have a lot of presentations that need to be shared outside of my company and I need a way to loop through all the speaker notes and remove them automatically. Is there a way to do this in VBA? I've search on this but can't seem to find anything.
+4
A:
This guy wrote a script that removes speaker notes from all PowerPoint files in a directory. You should be able to adapt it to suit your needs.
Sub RemoveSpeakerNotes()
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
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
BenV
2010-06-02 05:34:40
That is perfect, just what I needed!
Mahin
2010-06-02 20:40:22
Then you should accept this answer by clicking the hollow check mark off to the left.
BenV
2010-06-02 21:00:01
Oh, sorry about that. I just did it. Thanks again!
Mahin
2010-06-03 00:04:29