Word: Resize Image by Percent - Macro

25,226

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.

Share:
25,226

Related videos on Youtube

cantera25
Author by

cantera25

Updated on September 18, 2022

Comments

  • cantera25
    cantera25 over 1 year

    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
    cantera25 over 12 years
    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
    cantera25 over 12 years
    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.
  • CharlieRB
    CharlieRB over 12 years
    You're welcome. Glad to help.
  • tyoc213
    tyoc213 about 10 years
    This macro just saved me hours of click-clicking.
  • moloko
    moloko over 6 years
    Thanks for this, very helpful. There is a typo in your variable declaration on line 2 though, it missing the 'r' in 'PercentSize'.
  • CharlieRB
    CharlieRB over 6 years
    Thanks. FYI, you can make edits as part of the function of this site. :-)