开发者

Removing Speaker Notes from Presentations Programmatically

开发者 https://www.devze.com 2023-01-02 02:32 出处:网络
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

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 ca开发者_如何学Gon'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
0

精彩评论

暂无评论...
验证码 换一张
取 消