【问题标题】:Powerpoint - Save group as image via VBAPowerpoint - 通过 VBA 将组保存为图像
【发布时间】:2019-04-06 00:46:01
【问题描述】:

我想将一个组保存为 png 图像。

我可以将图像导出为完整的幻灯片,但我不知道如何仅导出特定组。

这适用于幻灯片:

Private Sub CommandButton1_Click()
    neuerText = TextBox1.Value
    ActivePresentation.Slides(1).Export "C:\bla\" & neuerText & ".png", "PNG"
End Sub

但是如何只选择一个组?例如

ActivePresentation.Slides(1).Shapes("Group 1").Export "C:\bla\" & neuerText & ".png", "PNG"

理想情况下,图像应具有透明背景。

有人知道我该怎么做吗?

【问题讨论】:

    标签: vba image export powerpoint


    【解决方案1】:

    使用ShapeRange 对象应该可以工作。

    Private Sub CommandButton1_Click()
        neuerText = TextBox1.Value
    
        Dim myGroup As ShapeRange
        Set myGroup = ActivePresentation.Slides(1).Shapes.Range("Group 1")
        myGroup.Export "C:\bla\" & neuerText & ".png", ppShapeFormatPNG
    End Sub
    

    【讨论】:

    • 感谢您的回答。现在我明白了:Laufzeitfehler '-2147188160 (80048240)': Shape (uknown member): Invalid request。要选择一个形状,它的视图必须处于活动状态。
    猜你喜欢
    • 2020-12-17
    • 1970-01-01
    • 2014-03-30
    • 2014-02-25
    • 1970-01-01
    • 2019-09-05
    • 1970-01-01
    • 2013-03-15
    • 1970-01-01
    相关资源
    最近更新 更多