質問

I currently have a PowerPoint macro which inserts a picture in the current slide with its original size:

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

How do I 'get' the size of the image? I want to do something similar to what is described in

Powerpoint VBA Macro to copy object's size and location and paste to another object

but "ShapeRange" doesn't seem to be selectable for the object I created.

役に立ちましたか?

解決

Try this one:

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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top