Document Editing Problems

How to Fix Duplicate QR Codes in Word Mail Merge Emails

Ayan MasoodAyan Masood Nov 2, 2026 869 views

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.

How to Fix Duplicate QR Codes in Word Mail Merge Emails
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.
Before you start

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.

Solution 1Recommended

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.

1
Reveal Document Field Codes

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.

2
Locate and Modify the Barcode Field

Find the code that looks similar to { DISPLAYBARCODE "DataField" QR }. Delete the word 'DISPLAYBARCODE' and type 'MERGEBARCODE' in its exact place.

3
Verify the Excel Reference

Ensure the syntax directly references your Excel column name correctly, formatted as { MERGEBARCODE YourColumnName QR }.

4
Hide Field Codes and Update

Press 'Alt + F9' again to hide the field codes. Select the QR code graphic and press 'F9' to update the field.

Replace the DISPLAYBARCODE Field with MERGEBARCODE
Test the Merge: Navigate to the Mailings tab and click 'Preview Results'. Use the Next Record arrow to confirm the QR code changes visually for each recipient.
Free Microsoft Office alternative

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. 1. Download and Install: Download WPS Office from the official website and run the installer.
  2. 2. Open Your Document: Launch WPS Writer and open your existing .docx mail-merge file; your formatting will remain intact.
  3. 3. Connect Data Sources Easily: Navigate to the References or Mailings tab to seamlessly connect your Excel data and finalize your document creation.
Fully compatible with Microsoft Word (.docx) and Excel (.xlsx) file formats.Streamlined interface for performing mail merges and data connections easily.Free to use and lightweight, ensuring smooth performance even on older computers.Comprehensive built-in PDF editing and document conversion tools.
microsoft office alternative - wps office

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.