Resizing all Images in an MS Word Document Using Macro

Resizing all Images in MS Word Documents Using Macro

MS Word is a popular word processing platform used by almost every business to write, maintain, and track their documentation. Although the platform is used widely, many are still unaware of the flexibility and customization abilities it holds.

This article explores one of the many interesting features of MS Word, which is Macro, and uses that to show the functionality of resizing all the images in a Word document.

Macro in MS Word

Macro is a series of commands that help you automate repetitive tasks in a matter of a few clicks. It allows you to record the steps of a task and then execute it using one click. You can automate many tasks like inserting formatted tables, designing formats, and resizing images.

To understand more about the wonders it can perform, let's look into the steps of resizing all the images in a Word document to a fixed size using macro.

Resizing all Images in an MS Word Document

To do so, follow the steps below:

1. Navigate to File and select Options. Click on Customize Ribbon from the sidebar to open the list of options. Ensure that the option named Developer is checked.

This adds a new tab named Developer to your navigation bar.

Word Options Popup Box

2. Click on the Developer tab to open the options and click on Visual Basic to open the code area for you to enter the code.

Visual Basic Option in MS Word

3. Select the document you want to execute the code in. Enter the following code in the code area:

Sub resize()

Dim i As Long

With ActiveDocument

    For i = 1 To .InlineShapes.Count

        With .InlineShapes(i)

            .ScaleHeight = x

            .ScaleWidth = y

        End With

    Next i

End With

End Sub

Note, enter the required height and width of the image in x and y respectively.

Macro Code Area in MS Word

4. Press F5 to run this code in the selected document.

5. Viola, this resizes all the images in your selected Word document to the entered size.

 

Word is much more than simple word-processing software. This was one of the examples of how extensively MS Word can be utilized in terms of its functionalities.

To help automate your day-to-day business tasks and make the most out of the extensive functionalities of MS Word, reach out to our coaches.

Previous
Previous

MS 365 Apps for Project Management

Next
Next

MS Copilot Across Different Microsoft Applications in 2024