题
我有很多演示文稿需要在公司之外共享,我需要一种方法来循环浏览所有扬声器笔记并自动删除它们。有没有办法在VBA中执行此操作?我已经搜索过,但似乎找不到任何东西。
解决方案
这家伙 编写了一个脚本,该脚本将目录中所有PowerPoint文件中的扬声器注释从所有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
不隶属于 StackOverflow