Inline ScaleHeight/ScaleWidth returns 0 in Word 2007



I thought I was going crazy till I found a similar post.

I am having a problem similar to the other post, where
ScaleHeight/ScaleWidth returns 0. My code also worked fine in 2003, but is
now broken.

In my case, I don't know what size the user will want the picture to be. In
2003, I got the desired width from the user in an InputBox. I applied that
value to Width. Then I scaled the height accordingly by making ScaleHeight
equal ScaleWidth:

UserWidth = InputBox ...
Selection.InlineShapes(1).Width = UserWidth
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).ScaleHeight =

Worked like a charm.

Now that ScaleHeight and ScaleWidth return 0, that line generates an error.
The width gets changed, but then the macro errors out and the height doesn't
get changed, even though LockAspectRatio equals True.

What do I need to do to my code to get it to work again?

And just out of curiosity, does anyone know why the functionality was changed?

Thanks very much for your help!




I think I figured it out:

Dim dWidth As Double
Dim dHeight As Double
Dim dNewWidth As Double
Dim dNewHeight As Double

dHeight = Selection.InlineShapes(1).Height
dWidth = Selection.InlineShapes(1).Width
dNewWidth = InchesToPoints(InputBox("Enter the new width in inches: ",
"Adjust Figure"))
dNewHeight = dHeight * (dNewWidth / dWidth)
Selection.InlineShapes(1).Height = dNewHeight
Selection.InlineShapes(1).Width = dNewWidth

Thanks, though.

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