How to Insert QR Code Images from Excel into Word Mail Merge
Question details
The user wants to display actual QR code images in a Word mail merge document using data from an Excel table, rather than showing the raw image URLs or error codes.

- Product
- Microsoft Word and Excel
- Device & OS
- not provided
- Scenario
- Performing a mail merge in Word using an Excel data source that contains links or paths to unique QR code images.
- Observed behavior
- The mail merge outputs the raw image URL text or a #VALUE! error instead of rendering the actual QR code image.
Ensure that all QR code image URLs or file paths in your Excel spreadsheet are correct and accessible. It is highly recommended to save a backup of your Word and Excel files before applying field codes or running VBA macros.
Use a VBA Macro for Advanced Mail Merge
Since standard mail merge fields often fail to download web images automatically, using a VBA macro ensures each QR code is accessed and inserted correctly.
A standard mail merge field returns the URL as text and does not automatically display the image. Using VBA-powered mail merge processing allows you to programmatically access or download each image and insert it into an image-capable merge field or bookmark.
Open your Word mail merge document and press Alt + F11 to launch the Microsoft Visual Basic for Applications (VBA) editor.
In the VBA editor, click on 'Insert' in the top menu and select 'Module' to create a blank script window.
Paste a VBA script designed to loop through your Excel data source, fetch the QR code image from the URL, and insert it into a designated bookmark in your Word template.
Press F5 or click the 'Run' button to execute the macro. The script will generate the merged documents with the rendered QR code images instead of text URLs.

Use the INCLUDEPICTURE Field Code
You can nest a MERGEFIELD inside an INCLUDEPICTURE field to dynamically load images from local file paths or URLs during a mail merge without using VBA.
Try WPS Office for Seamless Document Editing and Mail Merge
If you frequently encounter errors like #VALUE! or struggle with complex VBA workarounds in Microsoft Office, consider switching to WPS Office. It offers a highly compatible, lightweight, and free alternative with an intuitive Mail Merge feature.
- 1. Download and Install: Download WPS Office for free from the official website and install it on your device.
- 2. Open Your Files: Open your existing Word document and Excel data source directly in WPS Writer and WPS Spreadsheet without losing formatting.
- 3. Use Mail Merge: Navigate to the References tab in WPS Writer and use the Mail Merge feature to link your spreadsheet data seamlessly.

Frequently Asked Questions
Why does my mail merge show the image URL instead of the QR code?
Standard mail merge fields are designed to output plain text. When you insert a field containing an image URL, the word processor reads it as a text string. You must use specific field codes like INCLUDEPICTURE or a VBA macro to instruct the program to render the URL as an actual image.
Can I use local file paths instead of URLs for QR codes in Excel?
Yes. Using local file paths (e.g., C:\Images\qr-code.png) in your Excel spreadsheet is often more reliable than web URLs. You can use the INCLUDEPICTURE field in Word to reference these local paths during the merge, which avoids web download timeouts.
Why am I getting a #VALUE! error in my mail merge?
A #VALUE! error usually occurs when the data source contains a formula that Excel cannot evaluate properly, or when Word misinterprets the data type of the Excel column. Ensure your QR code column in Excel contains plain text URLs or paths, and that there are no broken formulas.
Do I need to update fields after finishing the mail merge?
Yes. If you are using the INCLUDEPICTURE method, the images will not appear immediately after merging. You must complete the merge to a new document, select all text by pressing Ctrl + A, and press F9 to refresh the fields and load the images.




