如何将 VBA 的图像裁剪为特定形式,例如PowerPoint 中的圆圈?

How to crop an image with VBA to a specific form e.g. circle in PowerPoint?

我想在 PowerPoint 中使用 VBA 将方形图像裁剪成特定的形状,例如一个圆圈。

Shape.PictureFormat只有这些选项:

有人可以帮我解决这个问题吗?

谢谢!

Microsoft Community - you can use Shape.AutoShapeType 到 "crop to shape."

Sub CropToCircle()
    Dim shp As Shape
    Set shp = ActivePresentation.Slides(1).Shapes(1)

    If shp.Type = msoLinkedPicture Or shp.Type = msoPicture Then
        shp.AutoShapeType = msoShapeOval
    End If
End Sub