문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top