How to automatically add captions to images in a Word document?

Suppose you have created a Word document that contains both text and images, and to easily navigate between these images, adding captions to all of them would be a good choice. The most common way is to select each image and insert a bookmark using the Bookmark function in Word. However, it can be time-consuming if you need to deal with many images. Here, we provide two methods for you to automatically add captions to all images at once in a Word document.

Automatically add captions to images at once using VBA:

The VBA code below can help add captions to all images at once in a Word document. Here’s how:

  1. Open the Word document containing the images you want to add captions to, press the Alt + F11 key combination to open the Microsoft Visual Basic for Application window.
  2. How to automatically add captions to images in a Word document

    How to automatically add captions to images in a Word document

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

Sub CaptionPictures()
‘Updated by Extendoffice 20181123
Dim xPic As InlineShape
For Each xPic In ActiveDocument.InlineShapes
xPic.Select
Selection.InsertCaption “Figure”, “”, “”, wdCaptionPositionBelow, 0
Next
End Sub
  1. Press the F5 key to run the code.

Now, captions will be added to all images in the current document at once as shown in the screenshot below.

We will be happy to hear your thoughts

Leave a reply

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