Need macro to set all pictures in document to a certain size

O

oli merge

Hi,

i need a macro to set all pics to a certain size (in this case 4.5cm high
and 2.81cm wide).

I have tried resizing the pictures to the desired size manually first but
its no good because i cant find a prgram to do it that is free and doesnt
have limits on quality or amount of pictures in batch.

I already have a macro to resize all pics to a percentage of the original
size, so if you just tell me how to set an absolute size I can adapt that.

thanks
 
L

Lene Fredborg

Below you will find a macro that resizes all pictures in the active document
to the size you specified.

NOTE: If your pictures are not in the text layer (wrapping style “In line
with text†- set via Format > Picture > Layout tab) but floating (any other
wrapping style), you must change the “Dim…†line and the “For each…†line to
the following:

Dim oShape As Shape
For Each oShape In ActiveDocument.Shapes

The macro:

Sub ResizePictures()

Dim oShape As InlineShape
For Each oShape In ActiveDocument.InlineShapes
With oShape
'Change msoFalse to msoTrue to scale proportionally
.LockAspectRatio = msoFalse
.Width = CentimetersToPoints(2.81)
.Height = CentimetersToPoints(4.5)
End With
Next oShape
End Sub

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
O

oli merge

cheers for your help lene. i ended up cheating and using .width = 87 etc
until I found the right dimensions, but I see now I could have just used the
centrimetres to points command.

Thanks again
 

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