Skip to main content

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

Author: Siluvia Last Modified: 2024-07-18

Inserting images into a Word document can greatly enhance its visual appeal and effectiveness. However, when dealing with detailed images or needing to save space, it can be helpful to allow readers to click and enlarge images for a closer look. Word does not have a built-in feature for click-to-enlarge images, but there are workarounds to achieve this effect.

In this tutorial, we will guide you through the steps to create clickable images that enlarge or expand when clicked, enhancing the interactivity and functionality of your Word documents.

Click to enlarge or expand image with VBA code

Resize all images at once with Kutools for Word


Click to enlarge or expand image with VBA code

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.

Microsoft Visual Basic for Applications window 1

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

Microsoft Visual Basic for Applications window 2

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.

Click to enlarge illustration


Resize all images at once with Kutools for Word

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.

Kutools for Word is the ultimate Word add-in that streamlines your work and boosts your document processing skills. Get It Now!

Click Kutools Plus > Resize, select a percentage from the drop-down list. See screenshot:

Kutools for Word's resize options 1

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:

Kutools for Word's resize options 2

Then all images in current document are resized based on selected one.


Office Tab: Brings tabbed interfaces to Word, Excel, PowerPoint...
ot word middle ad 100
Enhance your workflow now.      Learn More about Office Tab       Free Download

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

🤖 Kutools AI Assistant: Transform your writing with AI - Generate Content  /  Rewrite Text  /  Summarize Documents  /  Get Quick Answers, all within Word

📘 Document Mastery: Split Pages  /  Merge Documents  /  Export Selection in Various Formats (PDF/TXT/DOC/HTML...)  /  Batch Convert to PDF  /  Export Pages as Images  /  Print Multiple Files at once...

Contents Editing: Batch Find and Replace across Multiple Files  /  Resize All Pictures  /  Transpose Table Rows and Columns  /  Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces  /  Section Breaks  /  All Headers  /  Text Boxes  /  Hyperlinks  /  For more removing tools, head to the Remove group...

Creative Inserts: Insert Thousand Separators  /  Check Boxes  /  Radio Buttons  /  QR Code  /  Barcode  /  Diagonal Line Table  /  Equation Caption  /  Image Caption  /  Table Caption  /  Multiple Pictures  /  Discover more in the Insert group...

🔍 Precision Selections: Pinpoint Specific Pages  /  Tables  /  Shapes  /  Heading Paragraphs  /  Enhance navigation with more Select features...

Star Enhancements: Navigate to Any Location  /  Auto-Insert Repetitive Text  /  Toggle Between Document Windows  /  11 Conversion Tools...

Kutools and Kutools Plus tabs on the Word Ribbon
👉 Want to try these features? Download Kutools for Word now! 🚀
 
Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Yeah nice try, but it should really put the enlarged image in a temporary popup, instead of literally resizing the image!
This comment was minimized by the moderator on the site
OK...after clicking to expand, how do you get it to restore back to default size or click to default size?
This comment was minimized by the moderator on the site
It work in older world file, saved as .doc, but opened in MS 365.
This comment was minimized by the moderator on the site
Hi

The macro doesn't work as should. On MS Office 365 the resizing appear only for few mili sec.
This comment was minimized by the moderator on the site
Hi Thanks for the tip. I'm following the instructions on how to enlarge by using Macro, however I'm getting a error message "The type that was defined by user was ot defined" Any idea?
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations