我正在使用以下 VBA 宏删除 PowerPoint 幻灯片中的所有图片:
Public Function delete_slide_object(slide_no)
' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
' Delete object in slide
Set PPSlide = PPPres.Slides(slide_no)
For Each PPShape In PPSlide.Shapes
If PPShape.Type = msoPicture Then
PPShape.Delete
End If
Next PPShape
Set PPShape = Nothing
Set PPSlide = Nothing
Set PPPres = Nothing
End Function
Run Code Online (Sandbox Code Playgroud)
该代码删除了部分但不是全部图片。运行该代码3次后,所有图片都被删除。我哪里出错了?请告诉我
下面编写的代码用于使用vba-excel宏设置powerpoint中图像的位置和大小:
With ActiveWindow.Selection.ShapeRange
.Height = 400
.Width = 400
.Left = 50
.Top = 50
End With
Run Code Online (Sandbox Code Playgroud)
这些尺寸的单位是多少?400点等于多少英寸?