Applies ToWord 2013
Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Go way beyond basic mail merge commands. Unlock mail merge properties you can’t get to with Word commands alone and closely target your message to recipients.

Want more?

Field codes in Word

Mail merge

Take mail merge to the next level

If you use Mail Merge a lot in your business, then this course is for you.

In the last course, Take mail merge to the next level (see the summary at the end of this course for a link to it), we created this e-mail message using the commands on the MAILINGS tab.

Everything is okay with it except for one thing – the Mileage field doesn’t have a comma.

It may seem like a small thing, but to get that comma, we need to go beyond the basic Mail Merge commands.

When you turn off Preview Results, you see the Mail Merge fields that generated the merged text.

Now press Alt+F9 and you see the code that generated the merge field, called Field code.

Field codes are placeholders for data that you want Word to add automatically.

They are not just used for merge fields. Field codes are also used for things like Page Numbers and Automatic Tables of Contents.

By default, field codes are hidden from view.

But with the keyboard shortcut Alt+F9, you can toggle between viewing the field codes and their results.

In most cases, you never have to deal with field codes, because Word adds them automatically when you click commands, such as Insert Merge Field and Greeting line.

So why do you ever need to deal with field codes? Because there are some properties you can’t get to with Word commands alone.

And one of them is Merge Field number formatting, which will give us commas in numbers.

The field code MERGEFIELD Mileage, adds the Mileage merge field and that’s all.

If you want to use a different number formatting, then you need to use something called a switch, and you do that by typing the switch code directly in the field code.

Click after Mileage, press space, backslash, number sign, and space.

Then, in quotation marks, type three number signs, comma, and three more number signs.

This is called a Picture Switch – a switch that provides a picture of how you want Word to format the numbers.

The number signs inside the quotes are placeholders that Word replaces with numbers.

Press Alt+F9, and F9 to update the field code and preview the results. And there’s the comma.

Now, press Alt+F9, and let’s take a look at that field code.

Fields codes are made up of a field name, properties, and optional switches.

To learn more about a particular field code, you can check the reference documentation link in the course summary at the end of this course.

The MERGEFIELD reference shows you how to use the field code, lists the switches you can use with it, and provides examples.

In this example, the \f switch adds a space, if the MERGEFIELD contains some data.

If the MERGEFIELD is blank, no space is added.

This Web page lists all the field codes in Word and provides links to the references for each one.

This one describes how to insert and format field codes.

As you have probably figured out, field codes are not for everybody.

To use them, you’ll need to spend some time researching and experimenting with coding techniques.

But if you need to go beyond the basic Mail Merge commands, then field codes are your ticket.

Up next, we’ll dive into formulas and conditional statements.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.