如何使用 vsto powerpoint 删除所有图像占位符 powerpoint
How to delete all image placeholder powerpoint with vsto powerpoint
我正在尝试为 PowerPoint 2019 创建一个加载项。我只想删除 PowerPoint 中幻灯片上的图像。当我点击按钮时,我会在功能区上创建按钮,所有图像都会被删除。
Sub DeleteAllPictures()
On Error Resume Next
Dim PPSlide As Slide
For Each PPSlide In ActivePresentation.Slides
PPSlide.Shapes.Placeholders(1).Delete
PPSlide.Shapes.Placeholders(2).Delete
PPSlide.Shapes.Placeholders(3).Delete
PPSlide.Shapes.Placeholders(4).Delete
PPSlide.Shapes.Placeholders(5).Delete
PPSlide.Shapes.Placeholders(6).Delete
PPSlide.Shapes.Placeholders(7).Delete
PPSlide.Shapes.Placeholders(8).Delete
PPSlide.Shapes.Placeholders(9).Delete
PPSlide.Shapes.Placeholders(10).Delete
Next
End Sub
之前我使用 vba 宏删除了所有图像并且它有效。
作为vsto的新手,我不知道在哪里以及如何删除所有图像。任何形式的帮助将不胜感激。抱歉我的英语不好。
Shapes property of the Slide
class returns a Shapes
collection that represents all the elements that have been placed or inserted on the specified slide, slide master, or range of slides. The Shapes.Placeholders属性returns一个Placeholders
集合,表示幻灯片上所有占位符的集合。
尝试使用以下代码:
Sub DeleteAllPictures()
On Error Resume Next
Dim PPSlide As Slide
For Each PPSlide In ActivePresentation.Slides
Dim PPShapes as powerPoint.Shapes = PPSlide.Shapes
For Each PPPlaceholder In PPShapes.Placeholders
PPPlaceholder.Delete
Next
Next
End Sub
我正在尝试为 PowerPoint 2019 创建一个加载项。我只想删除 PowerPoint 中幻灯片上的图像。当我点击按钮时,我会在功能区上创建按钮,所有图像都会被删除。
Sub DeleteAllPictures()
On Error Resume Next
Dim PPSlide As Slide
For Each PPSlide In ActivePresentation.Slides
PPSlide.Shapes.Placeholders(1).Delete
PPSlide.Shapes.Placeholders(2).Delete
PPSlide.Shapes.Placeholders(3).Delete
PPSlide.Shapes.Placeholders(4).Delete
PPSlide.Shapes.Placeholders(5).Delete
PPSlide.Shapes.Placeholders(6).Delete
PPSlide.Shapes.Placeholders(7).Delete
PPSlide.Shapes.Placeholders(8).Delete
PPSlide.Shapes.Placeholders(9).Delete
PPSlide.Shapes.Placeholders(10).Delete
Next
End Sub
之前我使用 vba 宏删除了所有图像并且它有效。
作为vsto的新手,我不知道在哪里以及如何删除所有图像。任何形式的帮助将不胜感激。抱歉我的英语不好。
Shapes property of the Slide
class returns a Shapes
collection that represents all the elements that have been placed or inserted on the specified slide, slide master, or range of slides. The Shapes.Placeholders属性returns一个Placeholders
集合,表示幻灯片上所有占位符的集合。
尝试使用以下代码:
Sub DeleteAllPictures()
On Error Resume Next
Dim PPSlide As Slide
For Each PPSlide In ActivePresentation.Slides
Dim PPShapes as powerPoint.Shapes = PPSlide.Shapes
For Each PPPlaceholder In PPShapes.Placeholders
PPPlaceholder.Delete
Next
Next
End Sub