Easily create QR Codes in 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.
In Microsoft Word, Create your sticker template and link this to your Excel sheet by going to Mailings > Select Recipients > Existing List…
Add field codes for your stickers as required, via Mailings > Insert Merge Field and then choosing fields accordingly. (Click on Preview Results to preview).
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).
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.
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.
Right-click and press “Update Field” so that the field changes to show <<Barcode QR Code>>.
Continue with this process until the template has been filled with bar codes. Press “Preview Results” to preview and refresh.
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.
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
18 responses to “Easily create QR Codes in Word”
Wherever there’s an abundance of money and individuals stability is a perfect
matter.
I am so happy to find this post. Very useful and simple instructions are given.
A big thanks for your sharing.
The command in this article is only for Word2010 and does not work in newer versions.
After struggling for 2 days trying to get it to work, just found a new command for Word 2013.
See –> https://msdn.microsoft.com/en-us/library/hh745901(v=office.12).aspx
{DISPLAYBARCODE “text here in quotes” QR \q 3}
or use mailmerge with Excel such as
{DISPLAYBARCODE {MERGEFIELD Field2} QR \q 3}
Combining the new code – with knowledge gained from your page made quick work of my problem.
Hello John,
This article was written for the latest version of Word in Office 365, rather than older versions. Glad you sorted it out.
Thank you!!!
Thanks for that! The mail-merge form also needs to have quotes around it. This worked for me in Word 2016:
{ DISPLAYBARCODE "{MERGEFIELD VIN}" QR \q 0 \s 200 }
This is such a great article I was looking for.
But I am missing one part here, how do you get the barcode string?
Would appreciate if you help.
Hi, this is what I’ve got –
https://www.youtube.com/watch?v=xU-q1-dtGxI
but I have a problem with – Error! Bookmark not defined.
Thank you Adam explaining this very useful hidden feature.
On your example, you have textual fields on the left column and the QR on the right, like if you have multi column inside your label area. How did you manage this?
Hello, thanks for this most useful post. I was wondering where the numbers in the barcode column are coming from. Are they generated within Excel, and how do we make sure that they redirect to the URLs that we need? Do I need to have created the QR Codes one by one manually within Excel (or within MS Word)? Or do I simply write one URL in each row in the Barcodes column? Thank you in advance for your response.
it is an awesome tutorial, thank you so much!!
Thank for this article, after spending many hours trying to create mailmerge labels with QR codes, I finally came across this page and worked first go. Thank you. I’d appreciate if you could please advise how i can change the colour to black, thank you
Thank you for the really handy tutorial!
Press Ctrl + F9 to add a pair of empty field braces where the bar code is to go
I’m using Office 365 on a Mac. Can’t figure out how to get an empty braces to work. Typing the characters doesn’t do it.
«Name»
«Address1»
«Address2»
«Address3»
«Postcode»
Dear Mr
{MERGECODE «url» QR \S 70 H\ 100 \F 0XC7751B}
How to add more than one field in Word for example {mergebarcode field1 field2 field 3 QR } ? Thank you
Now that I can scan them, what software can be used to gather all those badges that I will scan and now have a list of? That is what I really need in lieu of printing tickets and having a long line at the banquet (ballroom entrance)–hence, BOTTLE NECKING.
Super valuable post and comments. Using Word 365 (Windows), I found the following to work for my situation.
I wanted:
1. A unique QR code that was the variable “SurveyURL” in the code below
2. The QR code to be ~1 inch square (2.6 cm)
What I learned:
For the URL to “work” in Word and create the QR code, the URL couldn’t have any spaces. For example, my “original” URL from Excel was:
https://customerfeedback.abcco.com/jfe/form/SV_bJi0jnNkM5LpQQS?Num=123456&Add=123 HANOVER RD FLORHAM PARK, NJ 07932
For the URL to work, it had to have no spaces:
https://customerfeedback.abcco.com/jfe/form/SV_bJi0jnNkM5LpQQS?Num=123456&Add=123%20HANOVER%20RD%20FLORHAM%20PARK,%20NJ%2007932
DISPLAYBARCODE “{ MERGEFIELD SurveyURL}” QR \s 45 \h 1000
I have tried the original code and the alternative codes. I am using O365.
Everything on my mail merge works correctly except for the QR code. It shows the QR code in the right format but always shows the very first QR code from the first record…it never changes to Next Record when the rest of the data changes.
I am using table that is 3 columns wide and 3 columns deep and the data and the QR code are both in the same cell.
Any ideas?