How to Fix Duplicate QR Codes in Word Mail Merge Emails
Question details
The user needs to resolve an issue where the same QR code is generated for all recipients during a mail merge, rather than creating unique QR codes for each record.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Generating customized emails with unique QR codes pulling data from an Excel spreadsheet using the Word mail merge feature.
- Observed behavior
- When using the DISPLAYBARCODE field, the mail merge outputs an identical QR code for every email instead of updating dynamically for each individual Excel record.
Verify that your Excel data source is properly formatted, ensuring the column containing the QR code data has a distinct header and unique values for every row.
Replace the DISPLAYBARCODE Field with MERGEBARCODE
Switching to the MERGEBARCODE field ensures that Word dynamically fetches the unique data for each row during the mail merge process.
The DISPLAYBARCODE field is meant for static documents and evaluates only once. For dynamic generation in bulk documents or emails, Microsoft provides the MERGEBARCODE field, which tells the mail merge engine to re-evaluate the barcode for every single record.
Open your main mail-merge document in Word and press 'Alt + F9' on your keyboard. This action toggles the view to reveal the underlying field codes instead of the visual QR codes.
Find the code that looks similar to { DISPLAYBARCODE "DataField" QR }. Delete the word 'DISPLAYBARCODE' and type 'MERGEBARCODE' in its exact place.
Ensure the syntax directly references your Excel column name correctly, formatted as { MERGEBARCODE YourColumnName QR }.
Press 'Alt + F9' again to hide the field codes. Select the QR code graphic and press 'F9' to update the field.

Use a Dedicated Mail Merge Barcode Add-in
If manually editing field codes results in syntax errors, a specialized Word add-in can automatically insert the correct dynamic barcode fields.
Switch to WPS Office for Seamless Document Management
If you frequently encounter field code syntax errors and formatting issues while working with complex mail merges, consider switching to WPS Office. It provides a familiar, intuitive interface and extensive compatibility with standard Office files without the frustrating troubleshooting.
- 1. Download and Install: Download WPS Office from the official website and run the installer.
- 2. Open Your Document: Launch WPS Writer and open your existing .docx mail-merge file; your formatting will remain intact.
- 3. Connect Data Sources Easily: Navigate to the References or Mailings tab to seamlessly connect your Excel data and finalize your document creation.

Frequently Asked Questions
Why does DISPLAYBARCODE work in normal Word documents but fail in a mail merge?
DISPLAYBARCODE is designed for static documents. When used in a mail merge, Word only evaluates it once during the initial document load, locking it onto the data of the first record. MERGEBARCODE is specifically engineered to trigger a re-evaluation for every single recipient row.
Do I need special fonts installed to generate QR codes with MERGEBARCODE?
No. Microsoft Word uses built-in graphic rendering to generate QR codes directly from the field code logic. You do not need to purchase or install third-party barcode fonts to display them.
Can I use MERGEBARCODE for other barcode formats like UPC or Code 128?
Yes. The MERGEBARCODE field supports a wide variety of barcode types. You simply need to replace the 'QR' argument in the field code syntax with the appropriate identifier, such as 'CODE128', 'UPCA', or 'EAN13'.
How do I ensure the QR code size stays consistent across all emails?
You can append sizing switches to your field code. For example, adding '\s 50' at the end of your MERGEBARCODE syntax scales the QR code graphic to 50% of its default size, preventing layout shifting in your email template.




