In automated document workflows—such as generating batch invoices, warehouse packing slips, conference attendee badges, or certified shipping labels—documents frequently require unique, scannable machine-readable symbols. While many organizations rely on third-party barcode fonts (like Free 3 of 9) or external graphic plugins that can fail during printer spooling, modern versions of Microsoft Word include native barcode rendering engines built directly into field codes. Using the MERGEBARCODE field, Word dynamically generates crisp vector barcodes and QR codes directly from Mail Merge data sources.
In this guide, you will learn how to configure MERGEBARCODE field codes, select barcode formats (QR, Code 128, Code 39), adjust scaling and error correction, and execute dynamic Mail Merges in Microsoft Word.
Understanding the MERGEBARCODE Field Code
Microsoft Word provides two native barcode field codes:
DISPLAYBARCODE: Renders a static barcode from fixed text directly typed into the document.MERGEBARCODE: Renders a dynamic barcode that extracts data from a connected Mail Merge field (such as an Excel column containing invoice IDs, customer URLs, or serial numbers).
When the merge executes, Word generates vector barcode graphics on the fly for each recipient record, eliminating the need to install specialized barcode TrueType fonts across multiple client workstations.
Syntax and Supported Barcode Types
The standard syntax for the MERGEBARCODE field is formatted as follows:
{ MERGEBARCODE MergeFieldName BarcodeType [Switches] }
Word supports numerous international barcode symbologies, including:
| Barcode Type | Typical Use Case | Data Supported |
|---|---|---|
QR |
URLs, vCards, mobile scanning, event tickets | Alphanumeric text, URLs, binary data |
CODE128 |
Logistics, inventory, package tracking | Full 128 ASCII characters |
CODE39 |
Government, military, manufacturing identification | Uppercase letters, digits, select symbols |
UPCA |
Retail consumer products (North America) | 12 numerical digits exactly |
EAN13 |
International retail consumer products | 13 numerical digits exactly |
Connecting Your Mail Merge Data Source
Before inserting barcode fields, connect your document to your tabular recipient list:
- Open a new or existing document in Microsoft Word.
- Navigate to the Mailings tab on the Ribbon.
- Click Start Mail Merge and choose your document type (e.g., Letters, Directory, or Labels).
- Click Select Recipients > Use an Existing List… and select your Microsoft Excel spreadsheet or CSV database.
- Select the worksheet and confirm that the first row contains column headers (such as
TrackingNumber,ProductSKU, orProfileURL).
Inserting a Dynamic QR Code Field
To generate a dynamic QR code that points to a personalized customer URL or contains record data:
- Position your cursor where the QR code should be rendered.
- Press
Ctrl + F9(orCmd + F9on Mac) to insert field brackets:{ } - Inside the brackets, type the
MERGEBARCODEstatement:{ MERGEBARCODE ProfileURL QR \s 120 \q M } - Press
F9(or right-click the field and select Update Field).
In this example:
ProfileURLis the Excel column header containing the web link.QRspecifies the Quick Response 2D matrix format.\s 120sets the scaling factor to 120% of standard size.\q Mdesignates the error correction level as Medium (recovers up to 15% damaged data). Options includeL(7%),M(15%),Q(25%), andH(30%).
Generating Linear 1D Barcodes (Code 128 & Code 39)
For industrial packaging slips or warehouse tracking numbers, linear 1D barcodes are standard:
# Dynamic Code 128 barcode with human-readable text
{ MERGEBARCODE TrackingNumber CODE128 \t \h 900 \s 100 }
# Dynamic Code 39 barcode without human-readable text
{ MERGEBARCODE PartSKU CODE39 \h 800 }
Useful switches for linear barcodes include:
\t: Displays human-readable numerical or text characters below the barcode bars.\h <units>: Sets the explicit vertical height of the barcode in twips (1/20 of a point; e.g.,\h 1000equals 50 points or approximately 0.7 inches).\s <percent>: Scales overall barcode dimensions uniformly.
Previewing and Finalizing the Mail Merge
To inspect your dynamic barcodes across multiple records before printing:
- On the Mailings tab, click Preview Results.
- Use the record navigation arrows (
Next Record/Previous Record) to scroll through your recipients. Word re-renders the barcode graphics for each individual record. - If the barcode appears blank or displays an error box, toggle the field code using
Alt + F9(orOption + F9on Mac) and verify that the column header name matches your Excel spreadsheet exactly. - When verified, click Finish & Merge > Edit Individual Documents… (or Print Documents…).
Word compiles the complete batch into a single document where each record contains a unique, high-resolution vector barcode ready for high-speed laser printing or PDF archiving.