我想打开当前文件夹中的每个PowerPoint(* .pptx),并清除所有图像和文本框的幻灯片母版,然后保存。 (它说我的帖子主要是代码,所以我需要添加更多的细节,所以这里有一句乔治华盛顿的报价,“如果你尊重你自己的声誉,那么与高质量的男人联系在一起;因为最好是独自一人比坏公司“)如何使用VBA清除PowerPoint中所有信息的幻灯片母版?
新代码
Sub DeleteSlideMasterShapes()
Dim i As Long
Dim shp As Shape
With ActivePresentation
For i = .Designs.Count To 1 Step -1
For Each shp In .Designs(i).SlideMaster.Shapes
shp.Delete
Next
Next i
End With
End Sub
Sub loopFiles()
Dim fso As New FileSystemObject
Dim fil As File
Dim fold As Folder
Dim yourfolder As String
Set fold = fso.GetFolder(Application.ActivePresentation.Path)
For Each fil In fold.Files
If InStr(1, fil.Name, ".pptx") > 0 Then
Application.Presentations.Open fil.Path
Call DeleteSlideMasterShapes
ActivePresentation.Save
ActivePresentation.Close
End If
Next fil
End Sub
您需要至少有1个Slide Master。您无法删除所有幻灯片。如果您尝试删除最后一个,它会引发错误。这就像试图删除工作簿中的所有工作表一样。关于清除SM,你能解释一下你到底想要达到什么目的吗? –
我有幻灯片的主人,其中包括标题中的图像和文本框,我想清除他们当前的信息 –