我有很多演示文稿需要在我公司之外共享,我需要一种方法来循环播放所有演讲者备注并自动删除它们。有没有办法在VBA中执行此操作?我在搜索这个但似乎找不到任何东西。
答案 0 :(得分:5)
This guy编写了一个脚本,用于从目录中的所有PowerPoint文件中删除发言者备注。您应该能够根据自己的需要进行调整。
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