Calculate a picture's scale height and width

R

Richard LT

I need to know how or what formulaWord uses to calculate a picture's scale
height and width when it is pasted from Excel into Word.

I have several Excel ranges/tables that vary in column/row numbers and a
rogram that copies the ranges in Excel and pastes them as metafile pictures
in Word. Before the image is pasted into Word I would like to give users a
visual indication of how much of the image will not fit in Word so they can
resize it until it fits w/o having to do it via trial and error.

Thank you so much for your help!

Richard
 
S

Shauna Kelly

Hi Richard

You can't do what you have in mind. What you can do is to paste the
picture and then get a reference to the picture. With the reference to
the picture, you can then find out how big it is and offer the user some
options. In cases like this I generally get the size of the image and if
it is wider than the margins (= PageWidth - LeftMargin - RightMargin),
then offer to re-size the image (ie change the ScaleWidth) to match the
margin width.

If the user changes their mind, you can delete the image your code just
pasted. Or, you can help the user out with a one-step "Undo" as
described at
http://groups.google.com/group/microsoft.public.word.word97vba/msg/c5f120a7817f3dbb

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

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