How to click to enlarge or expand image in Word document?

This article discusses how to zoom or expand images in a Word document with just one click.

Click to Zoom or Expand Images using VBA

The following VBA code can help you zoom images in a Word document with just one click. Here’s how to do it.

1. In the document containing the image you want to zoom with a single click, press Alt + F11 to open the Microsoft Visual Basic for Application window.

2. In the Microsoft Visual Basic for Application window, click Insert > Class Module. Then copy the VBA code below into the Class window.

VBA Code 1: Click to Zoom 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, the number 200 represents the specified height and width of the zoomed image. You can change the height and width as needed.

How to click to enlarge or expand image in Word document?

How to click to enlarge or expand image in Word document?

3. Click Insert > Module, then copy the code below into the Module window.

VBA Code 2: Click to Zoom Images

Dim cls As New Class1
‘Updated by ExtendOffice 20181129
Sub register_Event_Handler()
Set cls.GApp = Word.Application
End Sub

4. Press F5 to run the code and close the Microsoft Visual Basic for Application window.

Now, when you click on an image in this file, the image will be zoomed to the specific size you want.

With the implementation of the VBA code, you can easily enable the one-click zoom feature for images in your Word documents. This streamlined approach can significantly enhance your workflow and simplify the process of viewing and managing images within your documents. By tailoring the code to your specific needs, you can further customize the zoom behavior and ensure that it aligns perfectly with your requirements.

In case you encounter any issues or need further adjustments, you can revisit the VBA script to modify the parameters and functionalities to your liking. With these capabilities, handling and manipulating images in your Word documents becomes more intuitive and efficient, allowing you to focus on the content without the hassle of manually adjusting image sizes.

Should you require any additional assistance or have any further queries, please do not hesitate to reach out.

We will be happy to hear your thoughts

Leave a reply

Gotkey.net
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart