9

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.

cantera25
  • 193
  • 1
  • 1
  • 6

1 Answers1

10

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.

CharlieRB
  • 22,566
  • 5
  • 56
  • 105
  • Thanks CharlieRB - I appreciate the clear instructions. I almost have it working, but after executing the macro, Word becomes unstable -- I can no longer access anything from the Ribbon or close the program. Can you think of why this might be occurring? (I checked to make sure Windows XP / Office 2007 are fully updated.) Thanks! – cantera25 Dec 21 '11 at 19:27
  • 1
    Not sure why that would happen. I had no problem running it multiple times on several images before I posted it for you. The code should be just fine for Office 2007. Might want to reboot and try again. – CharlieRB Dec 21 '11 at 20:06
  • Still having issues, but it's definitely something on my end. Accepted your answer - thanks again! This had been a problem for me for quite a while. – cantera25 Dec 21 '11 at 20:48
  • You're welcome. Glad to help. – CharlieRB Dec 21 '11 at 21:00
  • This macro just saved me hours of click-clicking. – Pierre Arnaud Feb 20 '14 at 05:43
  • Thanks for this, very helpful. There is a typo in your variable declaration on line 2 though, it missing the 'r' in 'PercentSize'. – moloko Nov 11 '17 at 00:28
  • Thanks. FYI, you can make edits as part of the function of this site. :-) – CharlieRB Nov 11 '17 at 01:52
  • Awesome! Is it also possible to scale the image to a percentage of the page width, e.g. to 100%? Word does not allow this for some reason, it's always greyed out: https://i.imgur.com/H7LrDiQ.png – David.P Oct 15 '22 at 17:29