There is one document which contain many images. How I can to miniaturize of all images to 50%?
Thank you!
There is one document which contain many images. How I can to miniaturize of all images to 50%?
Thank you!
This works in 2003 - in 2007 it'll be different I think
[VBA]Dim iShape As InlineShape
For Each iShape In ActiveDocument.InlineShapes
iShape.Height = iShape.Height * 0.5
iShape.Width = iShape.Width * 0.5
Next iShape
[/VBA]
Thank you very much! It's good worked!
I don't think you can do it all in one go - you have to do each picture individually. Pictures may be of two types - InlineShapes and Shapes and the two are, as you might expect, different and you will need two loops ...
[vba]
For Each pic In ActiveDocument.Content.InlineShapes
If pic.Type = wdInlineShapePicture Then
pic.Height = pic.Height / 2
pic.Width = pic.Width / 2
End If
Next
For Each pic In ActiveDocument.Content.ShapeRange
If pic.Type = msoPicture Then
pic.Height = pic.Height / 2
If pic.LockAspectRatio = msoFalse Then
pic.Width = pic.Width / 2
End If
End If
Next
[/vba]
It seems as if the LockAspectRation of InlineShapes is ignored in code, whilst that of Shapes is honoured.
If you are looking to make the document physically smaller you may want to look at crop options and/or compressing pictures - although, depending on version, that may not be as successful as you would wish.
Enjoy,
Tony
---------------------------------------------------------------
Give a man a fish and he'll eat for a day.
Teach him how to fish and he'll sit in a boat and drink beer all day.
I'm (slowly) building my own site: www.WordArticles.com
Seems I was beaten to it
Enjoy,
Tony
---------------------------------------------------------------
Give a man a fish and he'll eat for a day.
Teach him how to fish and he'll sit in a boat and drink beer all day.
I'm (slowly) building my own site: www.WordArticles.com
TonyJollans, thank you!