【问题标题】:Embeding an OLE object in PowerPoint from Excel VBA - size and position does not work从 Excel VBA 在 PowerPoint 中嵌入 OLE 对象 - 大小和位置不起作用
【发布时间】:2019-05-31 11:58:30
【问题描述】:

我正在使用 Excel VBA 来更新 PowerPoint 演示文稿。我正在尝试将两个 excel 文件嵌入其中一张幻灯片中,并且我已经设置了所有参数,但大小和位置位似乎不起作用。

MyPresentation.Slides(9).Shapes.AddOLEObject Left:=142, Top:=142, Width:=200, Height:=170, Filename:=Met2FactSheet, _
DisplayAsIcon:=msoTrue, IconLabel:="Metro2 Fact Sheet"

对象是嵌入的,但根本没有调整大小(好像我省略了那部分代码)。

【问题讨论】:

  • 能否包含整个代码?

标签: excel vba


【解决方案1】:

先尝试将其分配给对象变量,然后尝试设置属性。比如……

Set ppShape = MyPresentation.Slides(9).Shapes.AddOLEObject( _
    Filename:=Met2FactSheet, _
    DisplayAsIcon:=msoTrue, _
    IconLabel:="Metro2 Fact Sheet")

With ppShape
    .Left = 142
    .Top = 142
    .Width = 200
    .Height = 170
End With

如果您使用早期绑定,您可以将ppShape 声明为PowerPoint.Shape。否则,如果您使用后期绑定,您可以将ppShape 声明为Object

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-24
    • 1970-01-01
    相关资源
    最近更新 更多