Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Scaling Graphics in a Macro.
Written by Allen Wyatt (last updated February 5, 2022)
This tip applies to Word 97, 2000, 2002, and 2003
You may have a need to routinely scale graphics in your document by a certain percentage. Using the menus to do the scaling can get tiresome, so you may want to do the scaling by using a macro you can assign to a toolbar button or a shortcut key. The following macro will handle doing the scaling very nicely:
Sub PictSize() Dim PercentSize As Integer PercentSize = InputBox("Enter percent of full size", _ "Resize Picture", 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
The macro first asks for a percentage by which you want to scale the selected image, offering 75 (75%) as the default. When you specify a percentage, the macro then checks to see if the selected graphic is an inline or a floating graphic. The reason for doing this is that the object specification is different in each case, as well as how the scaling is specified. Inline objects belong to the InlineShapes collection, while floating objects are set using the ShapeRange object.
If you want to resize all the graphics in your document by the same percentage, then you only need to modify the above macro so that it steps through each of the inline graphics and then each of the floating graphics.
Sub AllPictSize() Dim PercentSize As Integer Dim oIshp As InlineShape Dim oshp As Shape PercentSize = InputBox("Enter percent of full size", _ "Resize Picture", 75) For Each oIshp In ActiveDocument.InlineShapes With oIshp .ScaleHeight = PercentSize .ScaleWidth = PercentSize End With Next oIshp For Each oshp In ActiveDocument.Shapes With oshp .ScaleHeight Factor:=(PercentSize / 100), _ RelativeToOriginalSize:=msoCTrue .ScaleWidth Factor:=(PercentSize / 100), _ RelativeToOriginalSize:=msoCTrue End With Next oshp End Sub
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (7694) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Scaling Graphics in a Macro.
Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!
Ever want to expand the mail merge feature to include graphics? Merging graphics into your document is easy but requires ...
Discover MoreDrawing objects are easily added to a document. You can group these objects so they are easier to manage by following the ...
Discover MorePlace a graphic in your document, and you may want to make sure that your document text "wraps" around the edges of the ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-10-15 13:54:07
David
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: i.imgur.com/H7LrDiQ.png
2022-02-05 06:42:06
Daniel
Allen,
Thanks for this tip, but it's not very useful for my most common scenario. Mostly I am copying a web page into a Word document to nicely format and print the article (without all the garbage and bad formatting you get if you try to print a web page directly).
Most of the embedded images from the web page will be wider than my Word page size, but they often vary in width. So what I would like to be able to do with a macro is to change the WIDTH of all images in a document to some specified page width (e.g. 160mm for an A4 portrait page layout with 30+20mm in/out margins).
I hope the remaining removal work and return home all go smoothly!
Rgds,
Daniel
Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments