Question

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.

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top