Mac – Word: Resize Image by Percent – Macro

imagesmacrosmicrosoft wordmicrosoft-word-2007vba

I routinely paste many screen captures into Microsoft Word 2007 and then have to manually resize them to around 75%, which becomes very tedious.

The screen captures are all different sizes.

I've tried creating a macro for this, but I'm only able to write a macro that will resize a selected image to specific dimensions. And I can't get the macro recorder to recognize either manually resizing in the document window or using the Size dialog.

Is it possible to write a macro that will resize a selected image to 75% of its current size?

This question is similar to mine, but the user's requirement is to resize all of his images to the same size. I need to resize images that have an arbitrary height/width.

I'm also open to a technique that will paste images at a smaller size to begin with.

Best Answer

Copy this code to a module in VBA Editor (Alt + F11) for your document. If there isn't a module already, you can select to add one from the insert menu.

    Sub PicResize()
     Dim PercentSize As Integer

     PercentSize = 75

     If Selection.InlineShapes.Count > 0 Then
         Selection.InlineShapes(1).ScaleHeight = PercentSize
         Selection.InlineShapes(1).ScaleWidth = PercentSize
     Else
         Selection.ShapeRange.ScaleHeight Factor:=(PercentSize / 100), _
           RelativeToOriginalSize:=msoCTrue
         Selection.ShapeRange.ScaleWidth Factor:=(PercentSize / 100), _
           RelativeToOriginalSize:=msoCTrue
     End If
 End Sub

To run a this macro press Alt + F8, select PicResize from the list of macros and click RUN. You can also assign it to a button in a menu, if you want to just click each time to run the macro.

Related Question