How to resize a picture?

V

Vivian Carroll

In Word 2000 I have a macro to insert an picture that the user chooses,
select the picture , and then make the height 1" (72 pt) - keeping the width
proportional. I then want the macro to look at whether the width is greater
than 320 pt and if so, make the width exactly 320 pt - keeping the height
proportional (which means it will end up less than 1" - that's ok).

The first set of steps below work - the picture change to 1" high. The
second set of steps does not give an error message but does not do anything.
What do I need to do to make the macro resize the picture to 320 pt wide,
keeping the height proportional?

TIA,

Vivian Carroll




'SELECT & FORMAT THE PICTURE TO BE 1" HIGH - these steps work
With Selection
.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
.InlineShapes(1).Width = Selection.InlineShapes(1).Width *
72 / _
Selection.InlineShapes(1).Height
.InlineShapes(1).Height = 72

'CHANGE THE PICTURE TO BE ABOUT 3.2" WIDE IF IT IS WIDER THAN
3.2" - these steps don't work
If .InlineShapes(1).Width > 320 Then
.InlineShapes(1).Height =
Selection.InlineShapes(1).Height * 320 / _
Selection.InlineShapes(1).Width
.InlineShapes(1).Width = 320
End If

End With


End Sub
 
J

Jonathan West

Hi Vivian

It looks to me as if you have your unit conversions wrong. 3.2" is about
230pt, not 320pt.
 
V

Vivian Carroll

Boy do I feel stupid! Of course, that was the problem. Thanks for helping,
Jonathan!

Vivian
 

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