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
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