Skip to content

Easily create QR Codes in Word

G16th May 2018

CNo Comments

TExcel, Word

Did you know that it is possible to generate fully-functional QR codes in Microsoft Word using mail merge without the need for third-party plugins?

QR codes offer many advantages over the traditional line-type bar codes that have been in use for the last three decades, including better readability.

An industry has developed around supplying users with expensive QR code plugins for Microsoft Office programmes that rely on Visual Basic or ActiveX to work. Unfortunately, most of these utilities are clunky and require many steps to produce a single bar code.

In my line of work, I need to produce thousands of bar codes and I don’t have the time to craft them all by hand. As it turns out, Office 365 (ie the latest version of Word) has a native capacity to generate QR codes without the need to pay for additional plugins. Best of all, I can generate thousands of QR codes from an Excel spreadsheet using a familiar mail merge function which saves me lots of time.

This procedure describes a method for producing stickers in Microsoft Word that contain QR codes. I will assume that users have a basic understanding of how to use mail merge in Word from an Excel file. (If not, here is some basic help).

Part 1: Prepare your mail merge

The first step to creating the bar codes is to generate a database in Microsoft Excel. List all of your bar codes in a column. Populate other columns with pertinent information about whatever it is that you are bar-coding. Save your Excel sheet.

Screen capture of Excel sheet showing bar code data.

Create an Excel sheet that lists the bar codes and other relevant information that will be used on your labels.

In Microsoft Word, Create your sticker template and link this to your Excel sheet by going to Mailings > Select Recipients > Existing List…

Screen capture of Microsoft Word mail merge menu command.

Use Microsoft Word’s mail merge function to connect your template to your Excel spreadsheet.

Add field codes for your stickers as required, via Mailings > Insert Merge Field and then choosing fields accordingly. (Click on Preview Results to preview).

Screen capture of Microsoft Word mail merge tools.

Create your mail merge template by adding fields via Mailings > Insert Field.

Don’t forget to add a Next Record rule before each new label (except the first) via Mailings > Rules > Next Record. Do this until an entire page is filled (only one template page is required for mail merge).

Screen capture of Microsoft Word mail merge commands.

Add a “next record” rule between each new label.

Part 2: Adding QR codes

Now that the template is finished, we can add the QR codes. Adding QR codes is relatively easy because of the MERGEFIELD parameter, but requires a little bit of syntax. (Unfortunately MERGEFIELD cannot be inserted via any of the menu commands in Word).

In Microsoft Word, place your cursor where you want the first QR code to be positioned. Press Ctrl and F9 to insert a pair of empty field braces.

Screen capture of Microsoft Word showing empty field braces.

Press Ctrl + F9 to add a pair of empty field braces where the bar code is to go.

Type the following into the field where Barcode is the bar code string field from your mail merge:

{MERGEBARCODE Barcode QR \s 70 h\ 100 \f 0xC7751B}
  • MERGECODE is the Microsoft field syntax that activates the barcode generation.
  • Barcode is the parameter from the mail merge that contains the barcode string.
  • QR indicates that a QR code is to be generated.
  • The \s switch specifies the scaling factor in percent.
  • The \h switch specifies the height, in TWIPS (567 twips = 1 cm)
  • The \f switch specifies the foreground colour (in this case I chose a lovely blue: Hex 0xc7751B)

The QR code can be customised with additional parameters, including \b for a background colour and \t for the bar code string to be printed with the bar code.

Refer to the MSDN website for more information.

Screen capture of populated curly braces field in Microsoft Word.

Populate the empty field braces with the QR code formula.

Right-click and press “Update Field” so that the field changes to show <<Barcode QR Code>>.

Screen capture of Microsoft Word.

Right-click on the new field and choose “Update field” to activate the new QR code.

Continue with this process until the template has been filled with bar codes. Press “Preview Results” to preview and refresh.

Screen shot of Microsoft Word document with QR codes.

Fill the entire template with QR codes as required.

Save your template file. When you are ready to print your labels, go to Mailings > Finish and Merge… > Print Documents. (Do not choose File > Print).

Options

As suggested earlier, the QR codes that are produced are highly-customisable both in terms of size and colour. The MSDN website provides other additional switches that can be used to adjust the appearance of your QR codes. Alternatively, right-clicking on a QR code and choosing “Edit Barcode” will provide various options. By examining the resultant field codes, these styles can be applied across the entire sheet.

Screen capture of a dialogue box in Word.

The appearance of QR codes can also be updated with a dialogue box that will generate the approriate field tags and flags.

An astute eye would observe that this approach can be used to produce not just QR codes, but many other types as well, including the common Code 128 type.

Most significantly, this was achieved using the built-in capability of a current version of Microsoft Word without the need for third-party add-ins, software or fonts.

   

Comments:

No comments have yet been submitted. Be the first!

Have your say:

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.