小编use*_*496的帖子

使用 VBA 宏删除 PowerPoint 中的图片

我正在使用以下 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次后,所有图片都被删除。我哪里出错了?请告诉我

powerpoint vba image

6
推荐指数
1
解决办法
1万
查看次数

使用VBA的图像尺寸单位

下面编写的代码用于使用vba-excel宏设置powerpoint中图像的位置和大小:

With ActiveWindow.Selection.ShapeRange
    .Height = 400
    .Width = 400
    .Left = 50
    .Top = 50
End With
Run Code Online (Sandbox Code Playgroud)

这些尺寸的单位是多少?400点等于多少英寸?

excel powerpoint vba excel-vba

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

powerpoint ×2

vba ×2

excel ×1

excel-vba ×1

image ×1