The code below resizes all the images in a document to a fixed width & height, and then applies some properties to each image found.
It works well, with one drawback - it resizes the images only one time. I believe this is because the images are first converted from 'InlineShape' to 'Shape', and the second time you run the script, it will no longer find any 'InlineShape' image to convert.
What could I do to apply those properties to the images, and then have them resized multiple times, in various sizes?
Among other things, I tried adding 'oShape.ConvertToInlineShape' at the end of the loop, but without any success.
Alex
Code:
Dim oDoc As Document, oShape As InlineShape
Set oDoc = Application.ActiveDocument
For Each oShape In oDoc.InlineShapes
oShape.Width = 200
oShape.Height = 200
oShape.Select
Selection.Fields.Unlink
Set os = oShape.ConvertToShape
With os
.WrapFormat.Type = wdWrapTopBottom
.WrapFormat.AllowOverlap = False
.Left = wdShapeCenter
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
End With
Next oShape
Set oDoc = Nothing