我目前有一个PowerPoint宏,它在当前幻灯片中插入一张原始大小的图片:
Sub Insert_Traverse_2()
Dim oPic As Shape
Set oPic = ActiveWindow.View.Slide.Shapes.AddPicture("\\nlamvfs00065\homes\nlkpec\newpic.png", False, True, 0, 0, -1, -1)
End Sub
我如何获得'图像的大小?我想做类似于
中描述的事情Powerpoint VBA Macro to copy object's size and location and paste to another object
但" ShapeRange"对于我创建的对象,似乎无法选择。
答案 0 :(得分:5)
试试这个:
Sub Insert_Traverse_2()
Dim oPic As Shape
Set oPic = ActiveWindow.View.Slide.Shapes.AddPicture("\\nlamvfs00065\homes\nlkpec\newpic.png", False, True, 0, 0, -1, -1)
With oPic
MsgBox .Width
MsgBox .Height
MsgBox .Left
MsgBox .Top
End With
End Sub