PowerPoint Linked Picture Original Size

T

Tom

How can I find the original size of a linked picture from VBA. I have
searched through the ShapeRange object but can only find the current height
and width.

I have a number of slides with linked pictures that have somehow become
slightly off. It is only visible when I project them and I would like to find
them before I project them.

Thanks
Tom
 
S

Steve Rindsberg

How can I find the original size of a linked picture from VBA. I have
searched through the ShapeRange object but can only find the current height
and width.

I have a number of slides with linked pictures that have somehow become
slightly off. It is only visible when I project them and I would like to find
them before I project them.

I'm not sure what you mean by original size, Tom.

If you mean the size that PPT originally (and somewhat arbitrarily) made the
picture when it was imported, then here ya go:

Sub ResetPictureToOriginalSize(oSh As Shape)
With oSh
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
End With
End Sub

Sub Test()
Call ResetPictureToOriginalSize(ActiveWindow.Selection.ShapeRange(1))
End Sub
 
T

Tom

Close, I don't want to set it, I want to read it. Is there any way to see
what ScaleHeight is currently set to? More specifically I want to know if the
ScaleWidth and ScaleHeigth are equal in which case I know my image is not
skewed, when they are not equal I need to mark the slide so I can visibly see
that an image on the slide needs adjusting.

Thanks Steve for providing the answer you did.
 
S

Steve Rindsberg

Close, I don't want to set it, I want to read it.

In that case, you could

copy the image, run the code below, check its position/size against the original,
then delete it.

or

record the size/pos of the original in vars, run the code below, check against vars,
then reset it.

You'll want to check the Lock Aspect Ratio setting of the original first; you may
need to turn it off then reset it later.

Is there any way to see
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top