Written by Allen Wyatt (last updated May 1, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365
Gary is writing a large book that uses quite a few illustrations. In the caption for each illustration he uses a field for the illustration number. In the caption he would also like to have a QR code that references a URL on his website that includes, as part of the URL, the illustration number. Gary wonders if there is a way to create such a QR code within Word, without the need to utilize some external program or website.
To accomplish this task you can use a very esoteric field within Word. First, though, it is important to understand how Gary is generating his illustration numbers. He indicates that he is using a "field for the illustration number" in "the caption for each illustration." Captioning and numbering can be done automatically by Word. How you add such captions is described more fully in this WordTip:
https://tips.net/T6267
The captioning is implemented using text, a field, and a style. The caption text you specify in the Caption dialog box is inserted in a new paragraph below the figure, the paragraph is formatted using the Caption paragraph style, and the number is implemented using a SEQ field. This is all done automatically by Word, when you insert the caption. You can see this if you add the caption, position the insertion point immediately before the figure number, and then press Shift+F9. Word displays the field code:
{ SEQ Figure \* ARABIC }
Using the SEQ field allows the figure numbers to be updated if you move the figures and captions around in your document. Although it may not be evident at first, it is this flexibility—implemented through the caption's SEQ field—that makes the solution to Gary's task tricky. (You might think it is the QR code, but it isn't. More on that in a moment.)
Remember that Gary wants to include the "illustration number" within the URL that is used by the QR code. This means that not only is it necessary for the figure number in the caption to be changeable, but the URL needs to be changeable, as well. To set this up, you need to add a bookmark that encompasses the SEQ field used in the caption. Follow these steps:
DisplayBarcode "https://tips.net/fig
.png" QR \q 3
What you did was to instruct Word to add a QR code that leads to a URL that you constructed in steps 9 through 13. The text specified in step 9 is the portion of the URL before the variable figure number and the text in step 13 is the portion of the URL after the figure number. In the above steps, if the SEQ field pointed to by the bookmark named Desk2719 is 16, then the QR code will refer to the following URL:
https://tips.net/fig16.png
If your subsequent editing results in the figure number being updated, then the URL updates to reflect the new number of the figure, and the QR code updates accordingly.
If your QR Code isn't producing the desired target URL, it is most likely because you didn't put the quote marks in the right place or you added spaces that shouldn't be there. If I select the QR code and press Shift+F9, I can see the full field code, like this:
{ DisplayBarcode "https://tips.net/fig{ REF Desk2719 }.png" QR \q 3 }
Notice the opening and closing quote marks on the target URL, and that there are no spaces before or after the REF field. You will need to examine how you are specifying the URL to make sure that it is valid after the REF field is collapsed. (If you want, you can place the insertion point within the REF field and press Shift+F9 to collapse just that portion of the larger field structure.)
Note, as well, that the DisplayBarcode field must be typed in manually, as is done in step 9. This is because it is not presented as an option if you use the Field tool (Insert tab of the ribbon) to create a field. The field can create more than just QR codes; you can find more information about the field here:
https://support.microsoft.com/en-au/office/6d81eade-762d-4b44-ae81-f9d3d9e07be3
Note that if the QR code created by the above steps is too large for your needs (or not large enough), there are switches available that allow you to specify the height and width of the QR code created by the field.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10270) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.
Do More in Less Time! An easy-to-understand guide to the more advanced features available in the Microsoft 365 version of Word. Enhance the quality of your documents and boost productivity in any field with this in-depth resource. Complete your Word-related tasks more efficiently as you unlock lesser-known tools and learn to quickly access the features you need. Check out Microsoft 365 Word For Professionals For Dummies today!
Want to insert a dynamic cross-reference to a particular page number? It's easy to do following the steps in this tip.
Discover MoreIf you use the INCLUDEPICTURE field to add images to your document, you may love the macro in this tip. It allows you to ...
Discover MoreThe most common way of adding symbols to a document is to use the Symbol dialog box. There is another way, however, that ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments