Last active
November 15, 2017 08:45
-
-
Save zwf/73fd20c9cfdbe45e691bdf8bbe868992 to your computer and use it in GitHub Desktop.
resize images in word docs and horizontal center by word macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ResizeAllImagesAndHorizontalCenter() | |
Dim oShp As Shape | |
Dim oILShp As InlineShape | |
For Each oILShp In ActiveDocument.InlineShapes | |
With oILShp | |
.ConvertToShape | |
End With | |
Next | |
For Each oShp In ActiveDocument.Shapes | |
With oShp | |
.Width = CentimetersToPoints(10) | |
.Select | |
If Selection.ShapeRange.Type = msoPicture Then | |
Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom | |
Selection.ShapeRange.Left = ActiveDocument.PageSetup.PageWidth / 2 - ActiveDocument.PageSetup.LeftMargin - Selection.ShapeRange.Width / 2 | |
End If | |
End With | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment