views:

40

answers:

1

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
That is perfect, just what I needed!
Mahin
Then you should accept this answer by clicking the hollow check mark off to the left.
BenV
Oh, sorry about that. I just did it. Thanks again!
Mahin