You are on page 1of 1

http://answers.microsoft.

com/en-us/office/forum/office_2010-word/creating-a-macr
o-for-resizing-several-photos-in/b251f117-8d17-4522-bac4-d128c32587ba

There are a few details that need to be filled in before I could suggest a good
macro. The biggest one is whether all of the pictures are in line with text or h
ave some other text wrapping, or whether they're mixed. The difficulty here is t
hat Word assigns all the in-line pictures to the InlineShapes collection, and al
l the others to the Shapes collection. If you know that all the pictures are inline, then something like this will resize them:
Sub ResizePhotos()
Dim pic As InlineShape
For Each pic In ActiveDocument.InlineShapes
With pic
.LockAspectRatio = msoTrue
If .Width > .Height Then ' horizontal
.Height = InchesToPoints(3.3)
Else ' vertical
.Width = InchesToPoints(3.3)
End If
End With
Next
End Sub
If they all have some other text wrapping, then you need this version:
Sub ResizePhotos()
Dim pic As Shape
For Each pic In ActiveDocument.Shapes
With pic
.LockAspectRatio = msoTrue
If .Width > .Height Then ' horizontal
.Height = InchesToPoints(3.3)
Else ' vertical
.Width = InchesToPoints(3.3)
End If
End With
Next
End Sub
If there's a mixture, then you need to include both loops in the macro (and you
need different names for the variables in them, say pic1 and pic2).
I would recommend that the macro should include the addition of text under the p
ictures only if the text is exactly the same for all of them. Otherwise, it will
be more efficient to use Word's built-in Insert Caption button (on the Referenc
es tab) to add them one by one.

You might also like