You have a spreadsheet of SKUs, bin locations or asset numbers, and you want a sheet of labels where every label has a different barcode. Word's mail merge can do that, and the barcode image is built by Word itself, with no barcode font to install.
This guide walks through the setup with a Code 128 example, the data-prep mistakes that ruin a run, and the point where a dedicated label tool is the easier choice. It assumes Word for Windows, which is the version Microsoft documents.
What Word gives you
Microsoft says Word no longer has a built-in barcode tool, but you can still make barcodes with field codes (Microsoft Support). The field is called DisplayBarcode, and its syntax is { DisplayBarcode data type [switches] }. The type names include QR, CODE128, CODE39, UPCA, UPCE, EAN8, EAN13 and ITF14 (Microsoft Support).
Field braces can't be typed. Press Ctrl+F9 to insert a pair, then type inside them. Right-click the field and choose Toggle Field Codes to switch between the code and the picture.
Microsoft's page lists the data rules only in general terms: each type has its own data format, and data that doesn't fit the type may not render. For retail types, that means a valid number with a correct check digit. A plain barcode image still doesn't make a number yours, so read how to get UPC barcodes before merging retail codes.
Prepare the spreadsheet first
Most failed merges are data problems, not field-code problems. Before you open Word:
- Use one column per field, with a header in the first row. Word offers the header names as merge fields, so keep them simple, such as SKU, Item and Bin.
- Format code columns as Text. Microsoft warns that postal codes such as 00399 lose their leading zeros in a mail merge unless the column is formatted as text, and the same applies to any code that starts with zeros (Microsoft Support). Select the column in Excel and choose Text in the Number Format box on the Home tab.
- Put symbols in Word, not Excel. Microsoft suggests adding currency or percent signs in the merge document instead of the data. The same logic keeps a barcode value clean: only the exact characters to encode belong in the barcode column.
- Save under a new file name before you connect it to Word.
If you build the codes in a sheet, the Excel and Google Sheets guide shows how to calculate UPC check digits with a formula.
Build the label step by step
This follows Microsoft's labels procedure, with a barcode column called SKU.
- In Word, choose Mailings, then Start Mail Merge, then Labels, and pick the label product that matches your sheets.
- Choose Select Recipients, then Use Existing List, and open your Excel file. Confirm the first row holds your headers.
- Click in the first label. Type your text fields first, using Insert Merge Field for Item and Bin.
- Press Enter for a new line, then press Ctrl+F9 and type
DisplayBarcode ", including the opening quotation mark. - Press Ctrl+F9 again inside it and type
MergeField SKU. Move the cursor outside that inner brace, type a closing quotation mark, then a space,CODE128and any switches. - The finished field looks like this:
{ DisplayBarcode "{ MergeField SKU }" CODE128 \t \h 720 }
- Choose Mailings, then Update Labels so the other labels on the page get the same layout, then Preview Results.
Microsoft's own labels example ends its switches with a vertical bar, as in \h 1440| }, while the DisplayBarcode reference examples do not. If your preview shows no barcode, try adding the bar after the last switch.
Two switches matter here. \t prints the barcode data as text with the image, and \h sets the height in twips, which are 1/1440 inch, so 720 is half an inch (Microsoft Support). The \s switch scales the symbol from 10 to 1000 percent.
Microsoft also documents a MergeBarcode field that takes the merge field name directly, as in MergeBarcode SKU CODE128, and builds the DisplayBarcode from the merged value (Microsoft Support). It takes the same switches as DisplayBarcode, plus \a for Japanese postal barcodes, but its data argument is a merge field name instead of quoted text. If the nested form misbehaves, MergeBarcode is a documented alternative.
Switches to treat with care
A few switches change what gets encoded or drawn:
\dadds the start and stop characters for CODE39 and NW7 only. Leave it off Code 128, which has its own.\xcorrects an invalid check digit on types such as UPCA. That is handy for a throwaway test, but it means the bars may no longer match the number in your sheet. Don't use it on real retail labels.\fand\bset foreground and background colors. Keep dark bars on a plain light background, as the printing guide explains.
The page gives you height and percentage scale, not a bar width in millimeters. That means Word is a poor place to hit a precise X-dimension, so print one test sheet and judge it by scanning.
Check before you print the full run
Preview the results and compare a few barcodes with their rows. Look for these problems:
- A label with no barcode, or an error message in its place. Check the data for characters the type can't hold.
- A code that lost its leading zeros. Go back to the Text formatting.
- Bars crossing the label edge. Reduce
\sor\h, or switch to a larger label.
Then print one sheet on plain paper at 100% scale, hold it against a label sheet to check alignment, and scan labels from different columns with the scanner your staff will use. How to make barcode labels for a small business covers test batches and scanning.
When the label sheet tool is easier
Mail merge earns its setup time when each label carries more than a code: a product name, a size, a shelf location. For labels that are only a barcode and its value, the label sheet tool is simpler. Paste your list of up to 300 values, pick Code 128, Code 39 or QR, and print 30-up US Letter sheets or one label per page for a label printer. It flags duplicate values, which Word will happily print twice.
The trade-off is layout. The tool prints the barcode and, optionally, its value. It has no extra fields for names or prices.
Bottom line
Use mail merge when you need a barcode plus other fields from the same row, and keep every code column formatted as text. Use the label sheet tool when the code is all the label needs. Either way, scan a test sheet before you print the run.
Sources
- Microsoft Support: Field codes: DisplayBarcode (accessed )
- Microsoft Support: Field codes: MergeBarcode (accessed )
- Microsoft Support: Add barcodes to labels (accessed )
- Microsoft Support: Prepare your Excel data source for a Word mail merge (accessed )
