Manage appointments, plans, budgets — it’s easy with Microsoft 365.​

Field codes: MergeBarcode

This field code is analogous to the field code, MergeField. The main difference is that MergeBarcode generates a DisplayBarcode field based on the merge result instead of showing it directly. The syntax and supported switches is also different. The use of field-argument-1 is the same as the data field in the MergeField field.


{ MergeBarcode field-argument-1 field-argument-2 [ switches ] }

Field codes are not case sensitive.

  • Field-argument-1    Is the same as the data field in the MergeField field.

  • Field-argument-2    Is a string that specifies the type of barcode that will be generated. Barcode types are not case sensitive, so CODE39 is the same as Code39. The available types are UPCA, UPCE, JAN13, JAN8, EAN13, EAN8, CASE, ITF14, NW7, CODE39, CODE128, JPPOST, QR.

  • Switches    [optional] Field-specific switches. Some switches are barcode type specific.

QR    A QR 2D bar code. See Wikipedia: QR code. For the ISO specification, see ISO/IEC 18004:2006.

CODE128    A Code 128 linear bar code. See Wikipedia: Code 128. For the ISO specification, see ISO/IEC 15417:2007.

CODE39    A Code 39 linear bar code. See Wikipedia: Code 39. For the a Code 39 Faq and Tutorial, see Code 39 Barcode FAQ & Tutorial.

JPPOST    A Japanese Postal Service Customer barcode. JPPost is compliant with CBC (Customer Bar Code), which is also known as RM4SCC.

EAN8|EAN13    An EAN - International Article Number worldwide bar code for product ID’s (8 digit/13 digit), along with JAN8|JAN13, used where country of origin is required. See Wikipedia: EAN-8, Wikipedia: International Article Number (EAN-13), and EAN-13 and EAN-8.

JAN8|JAN13    A JAN: Japanese barcode for product ID’s (8 digit/13 digit). JAN8 is an alias of EAN8. JAN13 is an alias of EAN13.

UPCA|UPCE    A UPC (A&E): US barcode for product ID’s as specified in [GS1-BARCODE]. UPCA is used for most edible items, UPCE is a compressed version of UPCA. carrying the same data. See Wikipedia: Universal Product Code.

NW7    A NW-7 (CODABAR) serial number bar code. See Codabar (NW7).

ITF14    An ITF-14 item-tracking barcode for shipping and tracking as specified in [GS1-BARCODE]. See Wikipedia: ITF 14 and ITF-14 BARCODES

CASE    USPS barcode – FIM/POSTNET (*2) - barcode for tracking USPS mail. CASE is an alias of ITF14. See ITF-14 BARCODES

\h [field-argument]    Field argument specifies the height of the barcode symbol. The units are in TWIPS (1/1440 inch).

\s [field-argument]    Field argument specifies a scaling factor for the symbol. The value is in whole percentage points and the valid values are from 10 to 1000.

\q [field-argument]    Field argument specifies the error correction level of QR Code. Valid values are 0 - 3.

\p [field-argument]    Field argument specifies the style of a Point of Sale barcode (barcode types UPCA|UPCE|EAN13|EAN8). The valid values (case insensitive) are [STD|SUP2|SUP5|CASE].

\x    Fixes the check digit if it’s invalid.

\d    Adds Start/Stop characters for barcode types NW7 and CODE39.

\c [field-argument]    Field argument specifies the style of a Case Code for barcode type ITF14. The valid values are [STD|EXT|ADD]

\r [field-argument]    Field argument specifies the rotation of the barcode symbol. Valid values are from 0 - 3.

\f [field-argument]    Field argument specifies the foreground color of the barcode symbol. Valid RGB values are in the range of 0 to 0xFFFFFF.

\b [field-argument]    Field argument specifies the background color of the barcode symbol. Valid RGB values are in the range of 0 to 0xFFFFFF.

\t     Display barcode data (text) along with image.

\a    Concatenate all mapped address fields to generate a Japanese Postal Customer Barcode. The field-argument and Barcode-Type arguments and all other switches are ignored when this switch is used.


Each barcode may use its own data format, and so check some of the links if you're not sure what's needed.

To use MergeBarcode in a document, follow these steps:

  1. Click or tap where you want the barcode.

  2. Press Ctrl + F9. You must do this, as just typing curly brackets {} won't work.

  3. Type MergeBarcode plus arguments and switches. For example MergeBarcode URL QR \q 3, which displays a QR code of the URL that's merged in.

    A QR code of


For examples see MERGEBARCODE

Field codes: MergeField field

Field codes: DisplayBarcode

Need more help?

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.