【发布时间】:2014-03-30 07:53:52
【问题描述】:
我在 Microsoft Powerpoint 2013 演示文稿中嵌入了很多图片。在 Powerpoint 2013 中,我可以右键单击图片对象,然后使用“另存为图片”将图像保存到本地磁盘。但这是手动方式。我想知道是否有任何方法可以通过 VBA 实现自动化?我能够遍历 Shapes 集合,然后确定对象的类型。但我无法弄清楚哪些属性或方法与将图片存储到本地磁盘相关?以下是遍历 Shapes 集合并确定 Shape 是否为 msoPicture 类型的代码 sn-p
For currentSlideIndex = 1 To totalSlidesCount
Set currentSlide = ActivePresentation.Slides(currentSlideIndex)
For Each mediaShape In currentSlide.Shapes
mediaCounter = mediaCounter + 1 'for each shape in the slide
If currentSlideIndex = 3 Then
If mediaShape.Type = msoPicture Then
MsgBox ("Shape Type Picture is " + CStr(mediaShape.Type) )
End If
End If
Next mediaShape
mediaCounter = 0 'Reset to 0 for the new slide
Next
【问题讨论】:
标签: image vba powerpoint