[英]Delete all Images on one Slide with VBA in PowerPoint
我只想在 PowerPoint 中使用 VBA 删除幻灯片上的图像。
使用给定的代码,幻灯片上的所有形状都将被删除。
Sub DeleteAllPictures()
ActivePresentation.Slides(1).Shapes.Range.Delete
End Sub
使用以下代码添加图像:
Sub InsertPic_EAP()
'Insert Picture
ActivePresentation.Slides(1).Shapes.AddPicture FileName:="U:\Automatisierung\3D_Module\EAP.png", _
LinkToFile:=msoTrue, _
SaveWithDocument:=msoTrue, Left:=260, Top:=110, _
Width:=270, Height:=250
ActivePresentation.Slides(1).Shapes.AddPicture FileName:="U:\Automatisierung\Bilder_AP\EAP_01.png", _
LinkToFile:=msoTrue, _
SaveWithDocument:=msoTrue, Left:=620, Top:=220, _
Width:=270, Height:=115
End Sub
如何修改代码以仅选择和删除幻灯片上的图像。
此代码适用于您:编辑 - 对于链接的图片
Sub DeleteAllPictures()
Dim shp As Shape
For Each shp In ActivePresentation.Slides(1).Shapes
If shp.Type = msoLinkedPicture Then
shp.Delete
End If
Next
End Sub
循环浏览幻灯片中的所有形状,如果是图片则删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.