Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word macro that scales and object by a percentage 1

Status
Not open for further replies.

gemoon

Programmer
Mar 22, 2002
55
US
Im trying to write a macro for workd that among other things will scale an object's height and width to 70%.

I have pasted my code below. I used the macro recorder to get a starting point.

Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Solid
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalse
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 370.8
Selection.InlineShapes(1).Width = 397.45
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#
Selection.InlineShapes(1).Left = 0#
Selection.InlineShapes(1).Top = 0#
 
Hi gemoon,

If you have the shape selected, all you should need to do is:
Code:
[blue]Selection.InlineShapes(1).Height = Selection.InlineShapes(1).Height * 0.7
Selection.InlineShapes(1).Width = Selection.InlineShapes(1).Width * 0.7[/blue]
but please experiment a little to make sure you get what you want. I just had a quick play and the setting of .LockAspectRatio didn't quite behave as I expected.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thanks,
I ended up using

Selection.InlineShapes(1).ScaleHeight = 70
Selection.InlineShapes(1).ScaleWidth = 70

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top