How to click to enlarge or expand image in Word document?
This article is talking about how to enlarge or expand images in a Word document by a mouse click.
The following VBA code can help to enlarge images in a Word document with a click. Please do as follows.
1. In the document contains images you will enlarge by a click, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, click Insert > Class Module. Then copy below VBA code into the Class window.
VBA code 1: Click to enlarge images
Public WithEvents GApp As Word.Application 'Updated by ExtendOffice 20181129 Private Sub GApp_WindowSelectionChange(ByVal Sel As Selection) Dim xShape As InlineShape On Error Resume Next Set xShape = Sel.InlineShapes(1) xShape.Height = 200 xShape.Width = 200 End Sub
Note: In the code, number 200 is the specified height and width of the enlarged images. You can change the height and width as you need.
3. Click Insert > Module, copy below code into the Module window.
VBA code 2: Click to enlarge images
Dim cls As New Class1 'Updated by ExtendOffice 20181129 Sub register_Event_Handler() Set cls.GApp = Word.Application End Sub
4. Press the F5 key to run the code and close the Microsoft Visual Basic for Applications window.
Now, when clicking an image in this file, the image will be enlarged to the specific size as you desired.
The Resize images utility of Kutools for Word can help you to resize all images by a specified percentage or selected image. Please have a try.
Click Kutools Plus > Resize, select a percentage from the drop down list. See screenshot:
Then all images in current document are resized based on this specific percentage.
For resizing all images based on the selected picture’s size, you need to select the image first and then click Kutools Plus > Resize > Resize Images with Selection. See screenshot:
Then all images in current document are resized based on selected one.
If you want to have a free trial of this utility, please go to free download the software first, and then go to apply the operation according above steps.
Kutools for Word
More than 100 Advanced Functions for Word 2003, 2007, 2010, 2013, 2016 and 2019