0% found this document useful (0 votes)
80 views52 pages

Word 2013 - Mail Merge and Macros - studentFINAL

Word 2013_Mail Merge and Macros_studentFINAL

Uploaded by

daveasu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views52 pages

Word 2013 - Mail Merge and Macros - studentFINAL

Word 2013_Mail Merge and Macros_studentFINAL

Uploaded by

daveasu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

STUDENT MANUAL

Word 2013:
Mail Merge and
Macros
To w s o n U n i v e r s i t y

O f f i c e o f Te c h n o l o g y S e r v i c e s

OT S Training
Word 2013: Mail
Merge and
Macros
Word 2013: Mail Merge and Macros
Part Number: 222777
Course Edition: 1.0

Acknowledgements
PROJECT TEAM

Author Media Designer Content Editor

Pamela J. Taylor Alex Tong Angie French

Notices
DISCLAIMER
While Logical Operations, Inc. takes care to ensure the accuracy and quality of these materials, we cannot guarantee their
accuracy, and all materials are provided without any warranty whatsoever, including, but not limited to, the implied warranties of
merchantability or fitness for a particular purpose. The name used in the data files for this course is that of a fictitious company. Any
resemblance to current or future companies is purely coincidental. We do not believe we have used anyone's name in creating this
course, but if we have, please notify us and we will change the name in the next revision of the course. Logical Operations is an
independent provider of integrated training solutions for individuals, businesses, educational institutions, and government agencies.
Use of screenshots, photographs of another entity's products, or another entity's product name or service in this book is for editorial
purposes only. No such use should be construed to imply sponsorship or endorsement of the book by, nor any affiliation of such
entity with Logical Operations. This courseware may contain links to sites on the internet that are owned and operated by third
parties (the "External Sites"). Logical Operations is not responsible for the availability of, or the content located on or through, any
External Site. Please contact Logical Operations if you have any concerns regarding such links or External Sites.

TRADEMARK NOTICES
Logical Operations and the Logical Operations logo are trademarks of Logical Operations, Inc. and its affiliates.
® ® ®
Microsoft Office Excel 2010 is a registered trademark of Microsoft Corporation in the U.S. and other countries. Microsoft Office
® ® ®
Outlook and Microsoft SharePoint are also registered trademarks of Microsoft Corporation in the U.S. and other countries. The
other Microsoft products and services discussed or described may be trademarks or registered trademarks of Microsoft Corporation.
All other product and service names used may be common law or registered trademarks of their respective proprietors.
Copyright © 2012 Logical Operations, Inc. All rights reserved. Screenshots used for illustrative purposes are the property of the
software proprietor. This publication, or any part thereof, may not be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, storage in an information retrieval system, or otherwise, without
express written permission of Logical Operations, 500 Canal View Boulevard, Rochester, NY 14623, (800) 456-4677. Logical
Operations’ World Wide Web site is located at www.logicaloperations.com.
This book conveys no rights in the software or other products about which it was written; all use or licensing of such software or
other products is the responsibility of the user according to terms and conditions of the owner. Do not make illegal copies of books
or software. If you believe that this book, related materials, or any other Logical Operations materials are being reproduced or
transmitted without permission, please call (800) 456-4677.
Word 2013: Mail Merge
and Macros

Using Mail Merge ..........................................................................1


The Mail Merge Features................................................................ 2
Merge Envelopes and Labels......................................................... 18
Create a Data Source Using Word................................................. 24

Using Macros ..............................................................................27


Automate Tasks Using Macros......................................................28
Create a Macro............................................................................. 34

Lesson Labs.................................................................................41

Glossary...................................................................................... 45
Index...........................................................................................49
1 Using Mail Merge
Lesson Time: 50 minutes

Lesson Objectives
In this lesson, you will:
• Perform a mail merge.
• Merge envelope and label data.
• Create a data source using Word.

Lesson Introduction
You have seen how using a template can speed along the formatting of your documents.
Another useful feature is being able to customize documents for individual recipients. If you
have a list of the names, addresses, or other information that needs to go into each separate
document, you can use the mail merge feature to customize the documents, which is what
you will do in this lesson.
2 | Word 2013: Mail Merge and Macros

TOPIC A
The Mail Merge Features
If you have a document with static text, but you need to personalize it with the recipient’s name and
address, you can use the mail merge feature. Rather than manually entering the name and address on
each document, you can merge that data into your document, which greatly reduces the time needed
to prepare the documents. In this topic, you will perform a simple mail merge in a document.

Mail Merge
Mail Merge Fields and Amail merge is a process by which a list of data is inserted into a document to create multiple
Merge Results individualized documents. A main document contains the static information that will be in all of the
documents. It also contains fields into which the variable data will be inserted. The data source is a
list, a database, a spreadsheet—any type of structured data—that is inserted into the main document
during a mail merge. Examples of customized documents you can create include letters, envelopes,
labels, and phone and address books.
Note: The main document is an ordinary Word file into which you have inserted merge fields.

Figure 1-1: Mail merge fields and merge results.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 3

If you want to
demonstrate the items
covered in the concepts
in this topic, you can
start a mail merge now
and then as you go
through this topic, you
can demonstrate the use
of each of the items
discussed.
Data Source in a Word
Table

Figure 1-2: Data source in a Word table.

Mail Merge Fields


A merge field is a placeholder in the merge document that variable data is inserted into. The merge Mail Merge Fields
field provides a link to the variable information in the data source. The merge field name is
displayed in your document with double chevrons around the name. The merge field indicates the
category of data that will appear in your document at the location where the merge field is placed in
the document.
Explain that the
<<AddressBlock>> field
code contains specific
field names that it uses
to pull data from the data
source. These include
Figure 1-3: Mail merge fields are surrounded by double chevrons. First Name, Last Name,
Address 1, City, State,
There are several predefined types of merge fields you can insert in your main document. You can and Zip.
also add other fields using More Items, or you can manually insert the other fields in your
document.
The merge code is shown in the document. If you want to see the data instead, press Alt+F9 to
toggle between data and the merge code.
Matching Mail Merge
Address Block Fields
The <<Address Block>> field inserts the name and address from the data source. Microsoft®
Word automatically determines which data source fields contain the appropriate name and address
data. If your columns are named with something other than the default names, you will need to
manually match the data to the fields.
In the example shown in the following figure, the data source uses Street rather than Address 1 as a
column heading. Therefore, you need to manually match Street and Address 1.

Towson University Lesson 1: Using Mail Merge


4 | Word 2013: Mail Merge and Macros

Figure 1-4: If the data source uses different field names than those listed in the Address Block,
you need to match mail merge fields to fields in the source document.

Ask students whether


they would change the Note: Field names with a space in the column header show up in the Merge Fields list with an
data source file to use underscore where the space was.
the heading names or if
they would use Match
Fields. It would depend Greeting Line
on how else the source The <<Greeting Line>> field inserts the recipient’s name from the data source along with text
was used. If it is a file
they have complete
such as “Dear” or “To” followed by the name and punctuation. By default, it uses the First Name
control over and no and Last Name fields from the data source. You can manually select other options.
other application expects
the column heading to
be something specific,
they might consider
changing the heading in
the data source.
Insert Greeting Line
Dialog Box

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 5

Figure 1-5: You can configure the Greeting Line field through the Insert Greeting Line dialog box.

More Items Mail Merge


More Items Field
If you have fields that are not part of the address, phone, name, or other fields the Mail Merge
Wizard knows about, you can use the More Items link to add those fields to your document. You
can select from Address Fields or Database Fields. As with the other merge fields, position your
cursor in the main document where you want the field to appear, and then insert the merge field. In
the following figure, the “$3500” was added through a field in the data sourced named Total.
Note: If you select Address Fields, all possible fields are listed even if they are not in your data
source. The Database Fields selection lists only the fields in your data source.

In the data source file


the dollar value is in a
column named Total,
which shows up in More
Items as Total_ because
there is a space after
Total in the file.

Figure 1-6: The dollar value was added using the More Items mail merge field.

If you have access to an


Electronic Postage electronic postage
application, you can
If you have an electronic postage application installed on your computer, you can add the show students how it
Electronic Postage field. If you do not have an electronic postage application installed, you will be can be integrated into
prompted to install one. the mail merge process.

Towson University Lesson 1: Using Mail Merge


6 | Word 2013: Mail Merge and Macros

Mail Merge Rules


Rules
There are several rules you can use to programmatically select what data or how data is inserted in
the main document from the source data file. For example, you can use if, then, else logic to add
one block of text if a condition is met or another block of text if the condition is not met. Another
rule allows you to skip a record if a condition is not met. The available rules are listed on the
MAILINGS tab, in the Write & Insert Fields group from the Rules button drop-down list.

Figure 1-7: The available mail merge rules.

The following figure shows an example of using the If…Then…Else rule.


Mail Merge IF Rule
Engage students in a
discussion about how
they might use the IF
rule in their documents.

Figure 1-8: The mail merge IF rule specifies which field to compare, what to compare it to, and
what to insert in the document if it is true or false.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 7

Data Sources
A data source is a document in which information is listed in columns and rows. The columns are Mail Merge Data
categories of information. Each row contains the records for one set of data. The top row of the Sources
data source is the header row, which identifies the category of information in that column. The data
source can be:
• A database. Have students share
what types of files they
• An Outlook Contacts list or address book from another email program. expect their data
• Word tables. sources to be.
• An Excel worksheet.
• Comma separated value (CSV) or tab separated text files.

The Mail Merge Process


There are five main steps in the mail merge process. Mail Merge Process

Step Description

1) Create the main This document contains the static text and graphics that will be
document. included in all of the merge documents.
2) Connect the main The data source contains the variable data. It can be an existing
document and data source. document, or you can create a list within the Mail Merge Wizard.
3) If desired, specify which A copy of the main document is generated for each record in your
records to include. data source. If you only want to create documents for specific
records, you can specify which records to include. For example, only
records with a specific zip code or only records for people with a
failing test score.
4) Insert merge fields into Insert the fields from the data source into the main document to link
the main document. them together. The data source information will replace the
placeholder merge fields during the mail merge.
5) Preview and print or You can preview each of the documents prior to printing or
email the documents. emailing the merge documents.

The MAILINGS Tab


Mail merges are completed using the MAILINGS tab. You can use the Mail Merge Wizard or MAILINGS Tab
manually connect the main document and data source using options on this tab. Until you have
started the mail merge process, most of the buttons on the tab are dimmed. When an option is
enabled, like on other tabs, the button remains highlighted after selecting it. Buttons that you can
enable include the Highlight Merge Fields and Preview Results buttons.

Towson University Lesson 1: Using Mail Merge


8 | Word 2013: Mail Merge and Macros

Point out that most of


the buttons are dimmed
before you start a mail
merge.

Figure 1-9: MAILINGS tab before a mail merge is started (top) and after (bottom).

The Mail Merge Wizard


Mail Merge Wizard You can manually insert fields into your main document, or you can use the Step by Step Mail
Steps Merge Wizard. The wizard is available on the MAILINGS tab, in the Start Mail Merge group,
from the Start Mail Merge drop-down list. There are six steps in the wizard. Each step prompts
you for the relevant information to complete the step. The following table describes the steps.

Step Description

1. Select document type Choices include letters, envelopes, labels, or directory.


2. Select starting Choices include current document, start from a template, or start from
document existing document.
3. Select recipients Choices include use an existing list, Outlook contacts, or type a new list.
4. Write your letter In this step, you insert the merge fields. If necessary, you can also enter
the static text in the document.
5. Preview your letters In this step, you can preview any or all of the merged letters. You can
also make changes to the recipient list or exclude a recipient.
6. Complete the merge In this step, you can print all of the merged documents or edit
individual documents.

You don’t have to complete the merge all at once. You can save your main merge document. When
you open the document later, the associated data source is also opened. Open the Mail Merge task
pane to finish the merge.

Merge Dialog Boxes


Insert Merge Field If you are creating your merge document manually, there are some dialog boxes with which you
Dialog Box should become familiar.

Insert Merge Field


The Insert Merge Field dialog box is accessed in step 4 of the Mail Merge Wizard when you
select More Items, or if you are manually inserting fields, when you select Insert Merge Field
from the Write & Insert Fields group of the MAILINGS tab.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 9

Figure 1-10: You can manually insert fields using the Insert Merge Field dialog box.

Use the Address Fields option to select a built-in field that wasn’t included in one of the
predefined merge blocks you inserted. You also need to use this if the field names in your source
data document do not match those in the merge wizard.
Use the Database Fields option to insert a field that is not in the predefined list of fields.
Mail Merge Recipients
Mail Merge Recipients Dialog Box
The Mail Merge Recipients dialog box is accessed in step 3 of the Mail Merge Wizard when you
select Edit recipient list, or if you are done with the wizard or manually inserting fields, in the Start
Mail Merge group, select Edit Recipient List.

Towson University Lesson 1: Using Mail Merge


10 | Word 2013: Mail Merge and Macros

Point out the options for


Refine recipient list. Ask
students why they might
use these features.

Figure 1-11: Mail Merge Recipients dialog box.

Use this dialog box to add, remove, or edit recipients in the list. You can also sort, filter, find
duplicates, find recipients, and validate addresses.
Select Sort or Filter to display the Query Options dialog box. The Filter Records tab has options
to select the field to filter by, a comparison operation, and what to compare. The Sort Records tab
has options for which field to sort by and the sort order.

Unlink a Data Source


If you decide that you don’t want the document to merge with data from a data source, you can
revert the document back to a normal Word document. This is will unlink any fields from the data
source. You can leave it as a normal Word document or select another data source to use with the
document and set it up again.

Opening a Document with a Data Source Attached


SQL Warning Message When you open a main document that already has a data source attached, a warning dialog box is
displayed to let you know that the document will run a SQL command. Select Yes to continue
opening the document and using the data source.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 11

Figure 1-12: This SQL warning message is displayed when you open a source document that has
been attached to a data source document.

How to Perform a Mail Merge


You can perform a mail merge manually or through the Step-by-Step Mail Merge Wizard.
Note: Access the Checklist tile on the LogicalCHOICE Course screen to view all How To
procedures for this lesson.

Perform a Mail Merge with the Mail Merge Wizard


To perform a mail merge with the Mail Merge Wizard:
1. Create the static text that will be in all documents into which data is merged.
2. On the MAILINGS tab, in the Start Mail Merge group, select Start Mail Merge.
3. Select Step-by-Step Mail Merge Wizard. If a blank document is open or if Word cannot
determine the merge document type, the wizard opens to step 1. If Word can determine the
document type or if the merge already was started previously, it opens to step 3.
4. Complete step 1 of the Mail Merge Wizard.
a. In the Mail Merge pane, in the Select document type section, select the document type.
The choices are Letters, E-mail messages, Envelopes, Labels, or Directory.
b. At the bottom of the Mail Merge pane, select Next: Starting document.
5. In the Select starting document section, specify how you want to set up your document.
• The choices for letters, emails, and directories are Use the current document, Start from a
template, or Start from existing document.
• The choices for envelope or label are Use the current document, Change document
layout, or Start from existing document.
6. At the bottom of the Mail Merge pane, select Next: Select recipients.
7. In step 3 of the Mail Merge Wizard, in the Select recipients section, select where your data
source is located: Use an existing list, Select from Outlook contacts, or Type a new list.
8. If you selected Use an existing list:
a. Select Browse and then select the data source document. The Mail Merge Recipients
dialog box is displayed.
b. If desired, filter or sort the records or exclude recipients by unchecking the check box to the
left of the record.
c. Select OK.
9. If you selected Select from Outlook contacts:
a. Select Choose Contacts Folder.
b. Select the folder to use as the data source.
c. Select OK.

Towson University Lesson 1: Using Mail Merge


12 | Word 2013: Mail Merge and Macros

10. If you selected Type a new list:


a. Select Create to display the New Address List dialog box.
b. Enter the data for each recipient on a separate line.
c. Select New Entry to create additional recipients.
d. If desired, select Customize Columns to add additional fields.
e. When the list is complete, select OK.
11. If desired, select Edit recipient list to filter or sort the data source, or to exclude recipients
from the merge.
• To perform a one-level sort, select the desired column heading.
• To filter the data, select the drop-down next to a column heading and select the desired filter.
• To exclude a recipient from the merge, uncheck the check box for the recipient.
• Select OK to return to the Mail Merge pane.
12. Select Next: Write your letter.
13. Position the cursor in the document where you would like to insert a merge field.
14. If desired, select Address block to insert an address block from the data source.
a. The Insert Address Block dialog box is displayed.
b. Configure as desired using the available options in the dialog box.
c. If necessary, select Match Fields to link your data source to the predefined field names.
d. Select OK.
15. If desired, select Greeting line to insert a greeting line in the document.
a. The Insert Greeting Line dialog box is displayed.
b. Configure as desired using the available options in the dialog box.
c. If necessary, select Match Fields to link your data source to the predefined field names.
d. Select OK.
16. If an electronic postage application is installed on your computer and you would like to insert
electronic postage, select Electronic postage.
17. If you would like to insert merge fields other than those defined in the other three choices, select
More items to display the Insert Fields dialog box.
a. Select the desired field.
b. Select Insert.
c. Repeat as needed to insert fields.
d. When finished, select OK.
18. Select Next: Preview your letters.
19. In step 5 of the Mail Merge Wizard, if desired, select the Next or Previous buttons to preview
the output for each recipient.
20.If necessary, in the Make changes section, select Edit recipient list to make modifications to
the data source content in the Mail Merge Recipients dialog box.
21. If necessary, in the Make changes section, select Exclude this recipient to exclude the
recipient shown in the preview.
22.Select Next: Complete the merge.
23.If you want to send the merged documents to the printer, select Print. In the Merge to Printer
dialog box, select the records to print and then select OK.
24.If you want to save the individual documents created by the merge, select Edit individual
letters. In the Merge to New Document dialog box, select the records to save to a file and
then select OK. A new document opens as Letter1. Save it with the desired file name.

Perform a Mail Merge Manually


To perform a mail merge manually:
1. Create the document you want to use as the main document.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 13

2. On the MAILINGS tab, in the Start Mail Merge group, select the Start Mail Merge drop-
down and then select the type of merge document to create. The choices are Letters, E-mail
messages, Envelopes, Labels, and Directory.
3. In the Start Mail Merge group, select Select Recipients. The choices are Type new list, Use
existing list, and Select from Outlook Contacts.
4. If desired, filter or sort the data source.
a. Select Edit recipient list.
b. Select a field name drop-down and select a filter to filter which records to include in the
merge.
c. Deselect any records to exclude from the merge.
d. Select OK.
5. Position your cursor where you would like to insert a merge field. Be sure to add spacing and
punctuation around the field as needed.
6. In the Write & Insert Fields group, insert the merge fields or merge field blocks.
a. If desired, select Address Block to insert the name and address of recipients.
b. If desired, select Greeting Line to insert and configure the greeting for a letter.
c. If desired, select Insert Merge Field to select a field name from the list of available fields.
d. If necessary, select Match Fields to match your field name to a default field name.
e. Repeat substep c, and if necessary substep d, for each field you want to insert.
7. If you want to save the merged documents for editing or printing at a later time, in the Finish
group, select the Finish & Merge drop-down and then select Edit Individual Documents.
Specify which records to include in the document and then select OK. Save the document.
8. If desired, in the Write & Insert Fields group, select Highlight Merge Fields to make merge
fields stand out in the document. The shading is not printed; it is just a display feature.
9. If desired, in the Preview Results group, select Preview Results to display the records instead
of the merge fields in the document.
10. If desired, use the Next, Go to Record, and Previous controls to view different recipients in
the merge document.
11. If desired, in the Preview Results group, select Check for Errors to specify how to handle
errors during the merge process.
12. Print the merged documents.
a. In the Finish group, from the Finish and Merge drop-down, select Print Documents.
b. Specify which records to print and then select OK.
c. In the Print dialog box, print the documents the same way you would print other documents.
13. If desired (and if one of the fields in your data source is an email address), email the merged
documents.
a. From the Finish & Merge drop-down, select Send Email Messages.
b. Fill out the fields in the Merge to E-mail dialog box, and then select OK.

Unlink a Data Source


To unlink or detach the data source from your main document:
1. On the MAILINGS tab, in the Start Mail Merge group, select Start Mail Merge.
2. Select Normal Word Document.

Towson University Lesson 1: Using Mail Merge


14 | Word 2013: Mail Merge and Macros

ACTIVITY 1-1
Performing a Mail Merge

Data Files
C:\091025Data\Using Mail Merge\Customer data source.xlsx
C:\091025Data\Using Mail Merge\New store flyer.docx

Scenario
You created and got manager approval of the new store flyer that is going to be sent to customers.
The only things your manager would like to change are to add a generic greeting, to add each
customer’s address, and to personalize it a bit for high-volume customers. You realize that this
could all be accomplished using merge fields. You have an Excel spreadsheet with customer names
and addresses you can use for the mail merge.
You should consider
demonstrating this
activity before having 1. Prepare the New store flyer.docx file with merge fields as the main document for the mail merge.
students complete it. a) From the C:\091025Data\Using Mail Merge folder, open New store flyer.docx.
As students work b) On the MAILINGS tab, in the Start Mail Merge group, select Start Mail Merge.
through this activity, be
sure to be available if c) Select Step-by-Step Mail Merge Wizard.
anyone has questions or d) In the Mail Merge pane, in the Select document type section, verify that Letters is selected and then
gets stuck. select Next: Starting document.
e) In the Select starting document section, verify that Use the current document is selected and then
select Next: Select recipients.

2. Select Customer data source.xlsx as the data source for the mail merge.
a) In the Mail Merge pane in the Select recipients section, verify that Use an existing list is selected.
b) Select Browse.
c) Navigate to the C:\091025Data\Using Mail Merge folder and select Customer data source.xlsx.
d) Select Open.
e) Verify that Sheet1$ is selected and that First row of data contains column headers is checked.

f) Select OK.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 15

g) Observe the column names. These will become the field names that are used to merge data in each
record or row from the source document into the main document.
h) In the Mail Merge Recipients dialog box, select OK.
i) In the Mail Merge pane, select Next: Write your letter.

3. Insert the Address block for the inside address on the letter.
a) Position the cursor on the blank line above “Dear Customer.”
b) In the Mail Merge pane, select Address block.
c) Notice that the name, city, state, and zip code are listed in the Preview, but not the street.
d) Select Match Fields.
e) In the Match Fields dialog box, select the drop-down to the right of Address 1 and then select Street.

f) Select OK twice.

4. Replace the generic “Dear Customer” with the Greeting line merge block.
a) Select the text “Dear Customer,” and then press Delete to remove the generic greeting. If you want, you can
b) In the Mail Merge pane, select Greeting line. have each student select
different settings for
c) In the Insert Greeting Line dialog box, in the second drop-down list, select Joshua and then select
Insert Greeting Line,
OK.
then have them walk
around the room or
share their screens
during the preview step
to see how each
document displays the
greeting.

Towson University Lesson 1: Using Mail Merge


16 | Word 2013: Mail Merge and Macros

d) Select Next: Preview your letters.

5. Preview the main document with data.


a) Select the Next button

several times to view some of the merged data.


b) Select Find a recipient.
c) In the Find Entry dialog box, type Teodoro and then select Find Next.
d) Select Cancel.
e) Select Next: Complete the merge.

Have students look at 6. Add the Total_ merge field to the second paragraph with alternate text for high-volume and low-volume
the various comparisons customers.
they can use in the IF a) Position the cursor at the beginning of the second paragraph in the body of the letter and then type
rule. Ask them when Last year you spent $
they might use “is blank” b) On the MAILINGS tab, in the Write & Insert Fields group, select the Insert Merge Field drop-down.
or “is not blank”—they c) Select Total_.
might use those when
d) In the Write & Insert Fields group, select the Rules drop-down and select If…Then…Else.
they are sending out
reminders and a Replied e) Fill out the Insert Word Field: IF with the settings shown in the graphic.
column is still blank; the
text to insert might say
“Thank you for your
prompt response” or
“We eagerly await your
reply.”

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 17

f) Select OK.
g) Adjust spacing and punctuation as needed around the inserted fields.

7. Save the merge document for later printing.


a) In the Mail Merge pane, select Edit individual letters.
b) In the Merge to New Document dialog box, select All and then select OK.
c) Scroll through the Letters1 document to view the merged documents.
d) Save the Letters1 document in C:\091025Data\Using Mail Merge as My Merged Documents
e) Close My Merged Documents.
f) Save New store flyer.docx in the current folder as My New store flyer and then close the file.

Towson University Lesson 1: Using Mail Merge


18 | Word 2013: Mail Merge and Macros

TOPIC B
Merge Envelopes and Labels
You have created custom letters using data merged from a list into your main document. You can
also create customized envelopes and labels using merge data, which is what you will do in this
topic. You will see how you can simply merge the address information and print envelopes or labels
as easily as you created merge letters.

Merge Options for Envelopes and Labels


Envelope with Merge When you create envelopes and labels with merge fields, there are several options you can set. For
Fields and Merge envelopes, you can set the size, the font, and the position of return and delivery addresses, as well as
Results printing options such as face up or face down. For labels, you can set the label vendor, set the label
style number, specify your own dimensions for the label, and give printer information such as
continuous-feed printer or a specific printer tray.
Point out that if their
organization uses
envelopes with a
preprinted return
address, they will not
want to print the return
address when printing
envelopes.

Figure 1-13: An envelope with merge fields and merge results.

Create a Single Envelope or Label


If you just need to print a single envelope at any time, you can use this feature. Before you print all
of your merged envelopes or labels, you might want to print a single envelope or label to verify that
your printer options are correctly configured to print envelopes or labels. The MAILINGS tab
includes the option to print a single label or envelope. Instead of merging the data from a data
source, you enter the data in the Envelopes and Labels dialog box.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 19

Set Up a Return Address


You can use an advanced Word option to configure a return address that can be used whenever you
need to insert your return address on an envelope, label, or letter. To insert the return address
wherever you need it, from the Quick Parts menu, select Field, select UserAddress, and then
select OK.

How to Merge Envelopes and Labels


You can merge data to insert addresses into multiple envelopes or labels. You can also enter data
directly for a single envelope or label.

Merge Data for Envelopes or Labels


To merge data for envelopes or labels:
1. Open a blank document.
2. On the MAILINGS tab, in the Start Mail Merge group, select Start Mail Merge and then
select Step-by-Step Mail Merge Wizard.
3. In the Mail Merge pane, in the Select document type section, select either Envelopes or
Labels.
4. Select Next: Starting document.
5. If you are creating labels:
a. Select Label options. The Label Options dialog box is displayed.
b. Specify whether you are using a Continuous-feed printer or a Page printer. If using a Page
printer, specify the tray for the labels.
c. Select the Label vendor.
d. Select the product number that matches the labels you will be printing the data onto.
e. Select OK.
f. Select Next: Select recipients.
6. If you are creating envelopes:
a. Select Envelope options. The Envelope Options dialog box is displayed.
b. Specify the envelope size.
c. If desired, select the font and positioning for Delivery address and Return address.
d. Select the Printing Options tab to specify the envelope feed direction, whether the
envelopes are Face up or Face down, and the printer tray. If the envelopes are fed with the
short edge leading into the printer, you might need to check Clockwise rotation to prevent
the text front printing upside down on the envelope. The envelopes will print to the default
printer set up in Windows.
e. Select OK.
f. Select Next: Select recipients.
7. Select the recipients in the same way you selected them in the procedure titled “Perform a Mail
Merge with the Mail Merge Wizard.”
8. If you are creating envelopes, select Next: Arrange your envelope. If you are creating labels,
select Next: Arrange your labels.
9. Position your cursor in the document where you would like to insert fields, and then insert fields
using the Address block. If you would like to add additional fields, select More items.
10. If you are creating labels, select Update all labels to copy the layout from the first label to the
other labels on the page. Note: If you want to be sure your label data prints correctly on the
labels prior to printing on the actual label stock, print the output to a plain piece of paper, then
hold it up to the light with the label sheet behind the printed page to ensure that all data will fit
on individual labels without spilling over onto another label or printing across the edge of the
label.

Towson University Lesson 1: Using Mail Merge


20 | Word 2013: Mail Merge and Macros

11. If you are creating envelopes, select Next: Preview your envelopes. If you are creating labels,
select Next: Preview your labels.
12. Select Next: Complete the merge.
13. Select Print to send the document to the printer, or select Edit individual labels to write them
to a new file that can be saved for later editing and printing.

Print a Single Envelope


To print a single envelope:
1. On the MAILINGS tab, in the Create group, select Envelopes.
2. In the Envelopes and Labels dialog box, select Options to select the envelope size and
printing options.
3. From the Envelope size drop-down list, select the appropriate size. If desired, change the font
and positioning of the delivery and return addresses.
4. Select the Printing Options tab and then specify the Feed method.
5. Insert the envelope into the printer in the orientation you selected in the Feed method.
6. Select OK.
7. Type an address in the Delivery address box.
8. If desired, type an address in the Return address box, or select Insert Address to insert an
address from an electronic address book installed on your computer.
9. If you have an electronic postage program installed, you can select E-postage Properties and
set the appropriate options.
10. If you want to print the envelope without saving it, select Print.
11. If you want to save the envelope to print later or to reuse, select Add to Document. If a
document is already open, the envelope will be added as Page 1. If you have a blank document
open, save the file with an appropriate name.
12. Verify that the text printed correctly on the envelope. If not, try one of the following before
attempting to print the envelope again:
• Refer to your printer documentation to read about how envelopes should be loaded in the
printer.
• Adjust the printing options in the Envelope Options dialog box on the Printing Options
tab.

Print a Single Label


To print a single label:
1. On the MAILINGS tab, in the Create group, select Labels.
2. In the Envelopes and Labels dialog box, on the Labels tab, in the Address box, type the
desired text, or select Insert Address to insert an address from an electronic address book
installed on your computer.
3. If desired, select the text, right-click, and from the shortcut menu, change the Font or
Paragraph formatting.
4. Select Options, and then select the appropriate printer type and configure the label vendor and
product number. Select OK.
5. Under Print, select Single label. (If you want to print a whole sheet with the same label data,
instead of Single label, select Full page of the same label.)
6. If you are printing on a sheet of labels in which some of the labels have already been used, select
the Row and Column numbers for the label on which you will print.
7. If you want to print the label without saving it, select Print.
8. If you want to save the label to print later or add graphics to the label, select New Document. A
document is created with the labels laid out in a table. To add graphics to labels printed on a
page printer, the graphic must be added to each label.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 21

Set Up a Return Address


To set a return address in Word:
1. Select FILE→Options.
2. Select Advanced.
3. In the General section, in the Mailing address box, type the return address.
4. Select OK.

Towson University Lesson 1: Using Mail Merge


22 | Word 2013: Mail Merge and Macros

ACTIVITY 1-2
Merging Envelope and Label Data

Data Files
C:\091025Data\Using Mail Merge\Customer data source.xlsx

Scenario
You have created the personalized letters to send out to customers announcing the grand opening
of the new store. You need to create address labels to affix to the folded letters so you can mail
them to the customers. In the supply cabinet you found Avery 5351 labels. You would also like to
configure Word to remember the store address to use whenever you need to insert the return
address, and then print return address labels.
Be sure that you are
available to assist
students as they work 1. Set the return address to “345 Main Street, Greene, RL 99999.”
through this activity. a) If necessary, open Word.
b) Select FILE→Options.
c) Select Advanced.
d) Scroll down to the General section.
e) In the Mailing address box, type:

f) Select OK.

2. Create a merge document for Avery 5153 labels.


a) Create a new Blank document.
b) On the MAILINGS tab, in the Start Mail Merge group, select Start Mail Merge.
c) Select Step-by-Step Mail Merge Wizard.
d) Select Labels, and then select Next: Starting document.
e) Select Label options.
f) From the Label vendors drop-down, list select Avery US Letter.
g) From the Product number list, select 5351 Mailing Labels. You can click in the Product number list
and then type 5351 to jump to the label, or use the scroll bar.
h) Select OK. A blank table with each cell set to the size of an Avery 5351 label is created.
If Show/Hide ¶ is turned off, the table structure is not visible, but it is still there.

3. Select the recipient data source.


a) Select Next: Select recipients.
b) With Use an existing list selected, select Browse.
c) Browse to C:\091025Data\Using Mail Merge, select Customer data source.xlsx, and then select
Open.
d) Select OK.
e) Select OK.
f) Select Next: Arrange your labels.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 23

4. Insert the Address block merge fields and match the field for the Street field.
a) Select Address block.
b) Select Match Fields.
c) From the Address 1 drop-down, select Street, and then select OK twice.
d) Select Next: Preview your labels. The first cell of the table shows the first record from the data
source. The other cells appear blank if Show Field Codes is not enabled; if it is enabled it shows
<<Next Record>>.

5. Preview the labels.


a) Close the Mail Merge pane.
b) On the MAILINGS tab, in the Write & Insert Fields group, select Update Labels.
c) Verify that the data for each recipient is in a separate cell in the table.
d) Save the file to the C:\091025Data\Using Mail Merge folder as My Customer Labels

6. Create return address labels.


a) On the MAILINGS tab, in the Create group, select Labels.
b) In the Envelopes and Labels dialog box, on the Labels tab, check Use return address. The address
you set up in step 1 is added to the Address box.
c) Verify that Label is set to Avery US Letter, 5351 Mailing Labels. If it isn’t, select Options and select
it.
d) In the Print section, verify that Full page of the same label is selected.
e) Select New Document to insert the table of labels into a new document.
f) Save the file to C:\091025Data\Using Mail Merge as My Return Address Labels
g) Close all open files.
If time permits, have
students create
envelopes with merged
customer data.

Towson University Lesson 1: Using Mail Merge


24 | Word 2013: Mail Merge and Macros

TOPIC C
Create a Data Source Using Word
You have seen how to create letters, labels, and envelopes using an existing data source. You will
likely need to create your own data source at some point, and in this topic, you will create a data
source in Word.

Data Sources
Often, someone else will have created a list of data for you to use in a merge document. As
mentioned, data sources can be Word tables, CSV or tab separated text files, Excel worksheets, or
output from a database.

Data Guidelines
When you create a data source, no matter which application you use to create it, follow these
guidelines:
• The top row of the data must be the field names that categorize the data in each column.
• Each field name in the data source document must be unique.
• Field names should begin with a letter, when possible. If the field name begins with a special
character or number, an alpha character is added to the beginning of field names in merge fields
when inserted into a merge document.
• Field names must be less than 40 characters; shorter is better.
• If you use spaces in the field name, they will be replaced with underscores in the merge field
codes, so try to avoid using spaces.

How to Create a Data Source Using Word


You can create a data source using a Word table. No special formatting is needed. You could also
create a list separated by commas or tabs, with the first row being the field names.

Create a Data Source in Word


To create a data source in Word:
1. Open a new blank document.
2. Insert a table. The table needs to have one column for each field your data source needs.
3. On the first row of the table, type the column headings that will be used for the field names.
4. For each data record, type the information on a separate row in the table.
5. Save the document.

Lesson 1: Using Mail Merge OTS Training


Word 2013: Mail Merge and Macros | 25

ACTIVITY 1-3
Creating a Data Source Using Word

Data Files
C:\091025Data\Using Mail Merge\Manager promotions.docx
C:\091025Data\Using Mail Merge\Managers data.docx

Scenario
Your manager has finished employee interviews and is ready to send out the notices to the
employees who are being promoted to department managers in the new store. He gave you a list of
names with the department they will manage and their new salary. Instead of entering the
information manually for each new manager, you would like to create a source data document so
that you can merge the data and create the letters all at once.
Point out that this activity
could have used the
1. Examine the Word table to be used as a data source. Step-by-Step Mail Merge
a) From the C:\091025Data\Using Mail Merge folder, open Managers data.docx. Wizard, but that this is
good practice for
b) Notice that this is just a regular table created in Word. performing a merge
c) Close the file. without the wizard.
Students can use the
2. From the C:\091025Data\Using Mail Merge folder, open Manager promotions.docx. wizard if they prefer.

3. Replace the blanks in the document with the appropriate merge fields.
a) On the MAILINGS tab, in the Start Mail Merge group, select the Select Recipients drop-down and
then select Use an Existing List.
b) Browse to the C:\091025Data\Using Mail Merge folder and open Managers data.docx.
c) Select the first set of underscores.
d) In the Write & Insert Fields group, select the Insert Merge Field drop-down and select First_Name.
e) Select the next set of underscores and replace them with the merge field Department.
f) Select the last set of underscores and replace them with the merge field Salary.

4. Highlight the merge fields and preview the results.


a) In the Write & Insert Fields group, select Highlight Merge Fields to place a highlight over the merge
fields to make them easier to locate when previewing the results.
b) In the Preview Results group, select Preview Results.
c) Select Next Record several times to preview the merged letters.
d) Select Highlight Merge Fields to remove the highlight over the merge fields.
e) Save the file in the current folder as My Manager promotions
f) In the Finish group, select the Finish & Merge drop-down.
g) Select Edit Individual Documents.
h) With All selected, select OK.
i) Scroll through the new document to verify that the data was successfully merged.
j) Save the new document as My Merged Manager Promotions
k) Close all open files.
Verify that everyone
successfully completed
the activity.

Towson University Lesson 1: Using Mail Merge


26 | Word 2013: Mail Merge and Macros

Summary
In this lesson, you created customized labels, envelopes, and letters using the mail merge feature in
Word. You also created a data source document in Word for use in a mail merge. This is a useful
feature you are likely to use often if you need to send mass mailings in your organization.
How might you use mail merge in your organization?
A: Answers will vary, but might include: For creating mass mailing labels or envelopes, for creating folder
labels, or for customizing letters that have mostly static text and graphics, but need to be
personalized.

Will you use the wizard or the manual method for creating mail merge documents? Why?
A: Answers will vary, but might include: Using the wizard because it walks you through all of the steps to
create a merge document, or using the manual method if your field names don’t match what the
wizard expects them to be.

Note: Check your LogicalCHOICE Course screen for opportunities to interact with your
classmates, peers, and the larger LogicalCHOICE online community about the topics covered in
this course or other topics you are interested in. From the Course screen you can also access
available resources for a more continuous learning experience.

Encourage students to
use the social
networking tools
provided on the Logical
Choice Home screen to
follow up with their peers
after the course is
completed for further
discussion and
resources to support
continued learning.

Lesson 1: Using Mail Merge OTS Training


2 Using Macros
Lesson Time: 35 minutes

Lesson Objectives
In this lesson, you will:
• Automate tasks using macros.
• Create a macro.

Lesson Introduction
You have seen quite a few ways that you can automate tasks throughout this course. If you
have a series of commands and instructions that you perform often, you can group them
together as a single command called a macro. The macro will perform all of the tasks with a
single click.
In this lesson, you will create and use macros to automate tasks in Word. You can create
your own macros, and record the repetitive tasks that you want to add to the macro. You
can also create more complex macros with Visual Basic for Applications.
28 | Word 2013: Mail Merge and Macros

TOPIC A
Automate Tasks Using Macros
Do you wish you didn’t have to perform a long sequence of mouse clicks and keystrokes every time
you format something? It sure can be frustrating. You can bundle all of those mouse clicks and
keystrokes into a single mouse click or keyboard shortcut in a macro.

Macros
Results of Running a A macro is a set of instructions that are accessed and performed with a single mouse click or
Macro keyboard shortcut. Macros are used to automate a group of steps that are performed often. Each
macro must have a unique name within the document in which it is stored. Macros are usually
stored in templates, but can also be stored in documents. If you want the macro to be available in all
of your documents, store it in a global template such as the Normal template.
A template or document that contains macros has a different file extension than other templates and
documents. Instead of .dotx and .docx for regular template and document files, files with macros
end in .dotm and .docm.

Figure 2-1: Results of running a macro.

Note: This macro inserted a building block from the Quick Parts menu, inserted a header with
text in a different font, formatted italic; had a double-line border added to the paragraph; and
inserted the date and page number in the footer. All of this was accomplished with a single
keyboard shortcut defined to run the macro.

Lesson 2: Using Macros OTS Training


Word 2013: Mail Merge and Macros | 29

The Macros Dialog Box


You access existing macros from the Macros dialog box. You can run, edit, create, and delete Macros Dialog Box
macros from this dialog box. If you are troubleshooting a macro, you can use the Step Into button
to step through the macro to locate the step within the macro that is not working properly. The
Organizer button displays the Organizer dialog box, where you can copy macros from one
template or file to another. The Macros dialog box lists the macros stored in the selected file.

Figure 2-2: You manage macros through the Macros dialog box.

Note: The macros in the Macro name list are the macros from the file selected in the Macros
in drop-down list.

Macro Security
As useful as macros are, they are also a vehicle hackers often use to get their malicious software on
your computer. Macros use Visual Basic for Applications (VBA) programming code, which an
unscrupulous hacker can use to add viruses to a document. For this reason, only use macros from a
trusted source.
Note: Depending on your organization’s needs, the administrator might have set the macro trust
settings so that all macros are disabled in order to prevent macros from running.

Be sure students are


aware of how dangerous
Macro Security Components it can be to use macros
from an unknown
Manage macro security settings through the Trust Center. In order for a macro to run in your source. Macros can
document, the Trust Center evaluates several security risks before the macro is enabled, including: easily have malicious
• A digital signature from the developer. code included in them
that can infect the
• That the digital signature is valid and has not expired. student’s system and
• That the digital signature was issued by a reputable certificate authority. other systems on the
• That the developer is a trusted publisher. network.
If the macro fails to pass any of the security risk evaluations, the macro is disabled and a message is
displayed to indicate that there is a possibility that the macro is unsafe. If you are sure that the
macro is safe, you can enable it through the Trust Center.

Towson University Lesson 2: Using Macros


30 | Word 2013: Mail Merge and Macros

Digital Signatures
A digital signature is an electronic mathematical cryptographic method of proving the identity of the
macro publisher. It uses digital certificates issued by a certification authority.

File Validation
File validation is a process that checks any file you attempt to open from an untrusted source to verify
that it is a valid file. This is one way in which hackers can be thwarted from introducing macros with
malicious code into your system.
Trust Center Options
Trust Center
In the Trust Center, you can set the security and privacy settings for Microsoft® Word macros. The
security components you can configure there are listed in the following table.

Trust Center Option Description

Trusted Publishers Lists any publishers that are to be trusted. Be sure to check the
expiration date and remove any expired trusted publishers.
Trusted Locations Any location listed in this section is considered secure, so be sure
that a location is secure before you add a local or network path to the
list. Any files in these paths will not go through the file validation
process.
Trusted Documents Specify whether documents on the network should be trusted. You
can also disable trusted documents and clear all trusted documents so
that they are no longer trusted.
Macro Settings Specify whether to enable or disable macros. You can disable all
macros with or without notification, or disable all macros except
those that are digitally signed. Even though it is not recommended,
you can also enable all macros.
Message Bar Specify whether or not a message bar is displayed when macros are
blocked.

The DEVELOPER Tab


The DEVELOPER Tab To create a macro you use the DEVELOPER tab. You can also run or record a macro from the
VIEW tab, but the DEVELOPER tab has access to all of the tools you need to record, edit,
organize, and run macros.
Point out that even
though the
DEVELOPER tab is
displayed on the
classroom computers,
by default it is not
displayed. If it is not
displayed on their Figure 2-3: Macros are recorded and managed from the DEVELOPER tab.
computers, students will
need to use the Word
Options to display it.
Caution: The DEVELOPER tab is not displayed by default.

How to Automate Tasks Using Macros


If you create your own macros or receive them from another trusted publisher, macros can save you
a lot of time. Remember though, macros can contain malicious code, so be careful!

Lesson 2: Using Macros OTS Training


Word 2013: Mail Merge and Macros | 31

Note: Access the Checklist tile on the LogicalCHOICE Course screen to view all How To
procedures for this lesson.

Display the DEVELOPER tab


In some Word installations, the DEVELOPER tab is not displayed by default. To display the
DEVELOPER tab:
1. Select FILE→Options.
2. In the Word Options dialog box, select Customize Ribbon.
3. In the Customize Ribbon section, verify that Main Tabs is selected from the drop-down list.
4. In the Main Tabs section, select Developer.
5. Select OK.

Run a Macro
If you trust the source of the macro, use the following steps to run the macro:
1. Open a document that you want to use a macro in.
2. If prompted to enable or disable macros in the document, and if you trust the source, select
Enable Content.
3. If you know the keyboard shortcut for the macro, press the appropriate keys to run the macro.
4. If a button for the macro has been added to the Quick Access Toolbar, select the button to
run the macro.
5. If no keyboard shortcut has been created, you don’t know the keyboard shortcut, or no button
has been created for the macro:
a. On the DEVELOPER tab, in the Macros group, select Macros to display the Macros
dialog box. Alternatively, you can access the Macros dialog box from the VIEW menu, and
then in the Macros group, select Macros and select View Macros.
b. In the Macro name box, select the desired macro you want to run.
c. Select Run to run the macro, which will perform all of the tasks recorded in the macro.

Towson University Lesson 2: Using Macros


32 | Word 2013: Mail Merge and Macros

ACTIVITY 2-1
Automating Tasks Using Macros

Data Files
C:\091025Data\Using Macros\SmothersNewsletter.docm

Before You Begin


Verify that the DEVELOPER tab is displayed. If necessary, follow the steps in the “How to
Automate Tasks Using Macros” section to display it.

Scenario
The applications administrator for Smothers & Family Hardware created a new macro, SMacro2, for
formatting documents. You know you can trust the macro because it was created internally. Her
memo explaining how to use the new macro said the keyboard shortcut for it is Ctrl+Shift+Alt+D.
The macro formats documents so that the store name is properly formatted, along with proper
headers and footers. You are ready to add the store name, header, and footer to the document. The
administrator sent the macro as part of a document file, but she said if you add it to your Normal
template, it will be available in any new document.

1. Open the file containing the macro and enable macros.


a) From the C:\091025Data\Using Macros folder, open SmothersNewsletter.docm.
b) In the SECURITY WARNING message, select Enable Content.
c) Position the cursor at the beginning of the heading “Smothers & Family Hardware Opens New
Store.”

2. Run the SMacro2 macro.


a) On the DEVELOPER tab, in the Code group, select Macros.
b) In the Macros dialog box, select SMacro2.
c) Select Run. The Smothers & Family Hardware title is added to the top of the document along with a
header and footer on each page.

3. Remove the header and footer from the first page.


a) On the first page of the document, double-click in the Header area.
b) On the HEADER & FOOTER TOOLS DESIGN tab, in the Options group, check Different First Page.
This will remove the header and footer from the first page.

Note: Just because something is formatted or inserted with a macro doesn’t


mean that it can’t be edited or deleted.

4. Copy the SMacro2 macro to the Normal template.


a) On the DEVELOPER tab, in the Code group, select Macros.
b) Select Organizer.
c) In the left pane with SmothersNewsletter selected, select NewMacros.
d) With the Normal template selected in the right pane, select Copy.
e) Select Close.

5. Save the file in the current folder as My Macro Newsletter and then close the file.

Lesson 2: Using Macros OTS Training


Word 2013: Mail Merge and Macros | 33

You may want to show


Note: For more information, check out LearnTO Automate Document Formatting LearnTO Automate
from the LearnTO tile on your LogicalCHOICE Course screen. Document Formatting
from the LogicalCHOICE
Course screen or have
students navigate out to
the Course screen and
watch it themselves as a
supplement to your
instruction. If not, please
remind students to visit
the LearnTOs for this
course on their
LogicalCHOICE Course
screen after class for
supplemental
information and
additional resources.

Towson University Lesson 2: Using Macros


34 | Word 2013: Mail Merge and Macros

TOPIC B
Create a Macro
You have run a macro that was already created. In this topic, you will create your own macro.
Creating macros will help you more quickly perform repetitive, lengthy tasks with a single click or by
pressing the keys for a keyboard shortcut.

The Record Macro Dialog Box


The Record Macro When you record a macro, the Record Macro dialog box is displayed. In this dialog box, you
Dialog Box specify the name for the macro and you can optionally assign it to a button or a keyboard shortcut.
You can also add a description.

Figure 2-4: The Record Macro dialog box is displayed when you select Record Macro.

Note: It is a good idea to include the keyboard shortcut combination in the Description for the
macro.

Macro Names
A macro name must be unique within the file in which it is stored. The name must begin with a
letter and the name cannot contain any spaces. The name can be composed of letters, numbers, and
the underscore, but no other special characters.

Keyboard Shortcuts for Macros


When you are creating a macro, you can assign a keyboard shortcut to press to run the macro. In
order to make sure you don’t assign a key combination that is already assigned to something in
Word, check the Current keys section of the Customize Keyboard dialog box. If the key
combination is already assigned, the assignment is listed as shown in the following figure. If it is
already assigned and you don’t use that key combination, you can reassign it to your macro. If you
want to change the key combination you are assigning, press Backspace to remove what you have
in the Press new shortcut key box, and then press a new key combination.

Lesson 2: Using Macros OTS Training


Word 2013: Mail Merge and Macros | 35

Customize Keyboard
Dialog Box

Figure 2-5: Keyboard shortcut assignment for a macro.

If you forget which keyboard shortcut you assigned to a macro, or if you want to change the If the shortcut key
shortcut key combination, use the Customize Ribbon dialog box to access the Customize combination you select
Keyboard dialog box. There, the current keyboard shortcut is listed. You also have the opportunity is already assigned to
to assign a new keyboard shortcut. something, the Currently
assigned to message
will identify the
Buttons for Macros command to which it is
You can assign a macro to a button that is accessed from the Quick Access Toolbar. Word uses a already assigned. You
can choose to reassign it
default button icon for macros. You can select the macro name and add it to the toolbar, then to your macro or press a
select Modify and select one of the other symbols. different key
combination for the
shortcut key.
VBA
Macros are created in Visual Basic for Applications (VBA). VBA is a programming language embedded VBA Window
in Office applications. It is a subset of the Visual Basic (VB) programming language. While VB can
be used to create standalone applications, VBA programs run within the host application; for
example, within Word or Excel. When you record a macro, it is saved as VBA code. You can view
and edit the VBA code in the Visual Basic Editor.
The Visual Basic Editor interface has a Project pane that lists the VBA modules contained in all Point out that VBA is a
open documents and templates. The Normal template is listed, and each document is listed as a subset of VB. In VB, you
Project. If any templates besides Normal are open, they are listed as Template Projects. can create standalone
applications and VBA
Below the Project pane is the Properties pane. This lists the properties of the selected item in the programming is used to
Project pane. program within an Office
application.

Towson University Lesson 2: Using Macros


36 | Word 2013: Mail Merge and Macros

To the right of the Project and Properties panes is the Code window. You can view and edit the
code for the selected project in this window. Each macro that you record is saved in a block of VBA
code. Blocks of code are stored in a module. Each macro within the module is listed as Sub
macro_name() within the module.

Figure 2-6: The VBA window.

How to Create a Macro


You can record mouse clicks and keystrokes in a macro. If you need to select text as part of the
macro recording, it must be done with the keyboard rather than with the mouse. You will want to
plan your macro before you begin recording because every mouse click and key press will be
recorded as part of the macro. You should perform the steps prior to recording to test that the steps
produce the desired outcome.

Record a Macro
To record a macro:
1. Open a document. This can be the document in which you want to run the macro, or a blank
document. You just need a document open so you can access the Record Macro button.
2. On the DEVELOPER tab, in the Code group, select Record Macro. Alternatively, you can
access Record Macro from the VIEW tab, in the Macros group, from the Macros drop-down
or on the Microsoft Office status bar.
3. In the Record Macro dialog box, in the Macro name text box, type a name for the macro.
4. If desired, assign a keyboard shortcut or a Quick Access Toolbar button to the macro.
5. From the Store macro in drop-down list, select the file where the macro will be stored. Storing
it in the Normal template makes it available to all documents. Storing it in the current document
makes it available only in that document.
6. If desired, in the Description text box, type a description of the macro. If you are assigning a
keyboard shortcut, note the key combination in the description.

Lesson 2: Using Macros OTS Training


Word 2013: Mail Merge and Macros | 37

7. Select OK to begin recording. The mouse pointer changes to include a Tape icon indicating that
you are in recording mode. The Record Macro button on the DEVELOPER tab changes to
the Stop Recording button.
8. Perform the actions that you want to record in the macro.
9. If you need to pause during the creation of the macro, on the DEVELOPER tab, in the Code
group, select Pause Recording. While paused, the button changes to Resume Recording.
Select Resume Recording when you are ready to continue recording the macro.
10. When you have performed all of the actions that you want to include in the macro, on the
DEVELOPER tab, in the Code group, select Stop Recording.
11. If you are saving the macro to a document:
a. Select FILE→Save As.
b. From the Save as type drop-down list, select Word Macro-Enabled Document.
c. Enter the file name and then select Save.
12. Test the macro. If it is saved to the current document, you can run the macro from the open
document. If it is saved to the Normal template, open a new file to test the macro.

Copy Macros Between Documents


If you have macros in a document or template that you want to use in another document or
template, you can copy the macro so it is available. To copy a macro:
1. Select TOOLS→Templates and Add-Ins.
2. Select Organizer.
3. Select Macro Project Items.
4. Select Close File.
5. Select Open File and open the document or template that contains the macro you want to copy.
6. Select the desired macro and then select Copy.

Towson University Lesson 2: Using Macros


38 | Word 2013: Mail Merge and Macros

ACTIVITY 2-2
Creating a Macro

Scenario
You like the macro that your application administrator distributed recently, but you don’t need the
store logo in every document that you create. You just want the header and footer with the same
settings as she had in her macro. The header is Smothers & Family Hardware in 11 point, italicized,
Arial Rounded MT Bold font that is centered with a double red underline across the entire page.
The footer has the date and time on the left with the page number on the right. Because you can’t
have spaces in the macro name, you will abbreviate Smothers & Family Hardware Header and
Footer as SH_HdrFtr for the macro name.

Walk around the room 1. Open a new blank document and begin creating the SH_HdrFtr macro.
as students complete a) Open a new Blank document.
this activity to make sure b) On the DEVELOPER tab, in the Code group, select Record Macro.
everyone is able to
c) In the Record Macro dialog box, in the Macro name box, type SH_HdrFtr
complete the activity
without any problems. d) In the Store macro in list box, verify that All Documents (Normal.dotm) is selected so that the macro
is available in all documents based on the Normal template.
e) Select Keyboard.
f) In the Customize Keyboard dialog box, in the Press new shortcut key text box, press Alt+S.
g) Notice that this key combination is shown to be currently unassigned.
h) Select Assign. The Current keys box now lists Alt+S.
i) Select Close. The mouse pointer has a Tape icon attached to it.

2. Record the macro to add a header and footer to the document.


a) Select the INSERT tab.
b) In the Header & Footer group, select the Header drop-down and select Edit Header.
c) Select the HOME tab.
d) In the Font group, select Arial Rounded MT Bold, and select Italic.
e) In the Paragraph group, select Center.
f) From the Borders drop-down, select Borders and Shading.
g) Add a double-line border to the bottom of the paragraph and then select OK.
h) In the Header area, type Smothers & Family Hardware Store
i) Select the INSERT tab.
j) In the Header & Footer group, select the Footer drop-down and select Edit Footer.
k) On the INSERT tab, in the Text group, select Date & Time.
l) Select the mm/dd/yyyy hh:mm format and then select OK.
m) Press Tab twice and then type Page
n) In the Text group, from the Quick Parts drop-down list, select Field.
o) From the All category, select Page, and then select OK.

3. On the DEVELOPER tab, in the Code group, select Stop Recording.

4. Test the macro in a new document.


a) Open a new Blank document.
b) Press Alt+S.
c) Verify that the header and footer were added to the document.

5. Examine the VBA code for the SH_HdrFtr macro.

Lesson 2: Using Macros OTS Training


Word 2013: Mail Merge and Macros | 39

a) On the DEVELOPER tab, in the Code group, select Macros.


b) If necessary, set Macros in to Normal.dotm.
c) Select SH_HdrFtr and then select Edit to open the macro in Microsoft Visual Basic for Applications.
d) Scroll through the code for the macro. Notice that it begins with the Sub SH_HdrFtr() line. Many of
the lines of code resemble English statements.
e) Close the editor.

6. Close all open documents without saving.

Towson University Lesson 2: Using Macros


40 | Word 2013: Mail Merge and Macros

Summary
In this lesson, you used a macro that someone else had written and saved to a document. Then you
created your own macro and saved it to the global template, Normal.dotm, so that it is available in
any document you create. Being able to record and run macros will save time when you have to
perform a repetitive series of mouse clicks and keystrokes.
Do you have any tasks that you routinely perform that could benefit from being compiled into a macro?
A: Answers will vary, but might include: Adding standard organization headers and footers to documents,
formatting text, and any other repetitive tasks that you perform on a regular basis.

What are some benefits and drawbacks to using macros?


A: Answers will vary, but might include: Benefits are that after being recorded, a macro can save time
when performing complex tasks and reducing errors in documents; drawbacks might include that
some organizations might not allow macros because of the possibility of malicious code being
included in macros, especially macros that came from a source outside the organization.

Note: Check your LogicalCHOICE Course screen for opportunities to interact with your
classmates, peers, and the larger LogicalCHOICE online community about the topics covered in
this course or other topics you are interested in. From the Course screen you can also access
available resources for a more continuous learning experience.

Encourage students to
use the social
networking tools
provided on the Logical
Choice Home screen to
follow up with their peers
after the course is
completed for further
discussion and
resources to support
continued learning.

Lesson 2: Using Macros OTS Training


Lesson Labs

Lesson labs are provided as an additional learning resource for this course. The labs may or
may not be performed as part of the classroom activities. Your instructor will consider setup
issues, classroom timing issues, and instructional needs to determine which labs are
appropriate for you to perform, and at what point during the class. If you do not perform
the labs in class, your instructor can tell you if you can perform them independently as self-
study, and if there are any special setup requirements.
42 | Word 2013: Mail Merge and Macros

Lesson Lab 1-1


Using Mail Merge

Activity Time: 20 minutes

Data Files
C:\091025Data\Using Mail Merge\Vendor Letter.docx

Scenario
You are preparing letters to go out to vendors. They need to be personalized to
indicate the type of merchandise you purchase from the vendor, along with the vendor
contact’s name and address. You will be mailing these out in envelopes that need the
vendor addresses merged into them for printing.

1. Create a data source document named Vendors with five vendor names, addresses, and
one product for each vendor. (You can use Word or Excel to create the data source
document, or you can type the list as part of the merge process—your choice.)

2. From C:\091025Data\Using Mail Merge, open Vendor Letter.docx.

3. In the Vendor Letter file, select your data source document to merge.

4. In the Vendor Letter file, insert the address block for the vendor to replace the
placeholder text for the inside address.

5. Insert the product field to replace the product placeholder.

6. Review the merged documents.

7. Save the merged documents to a file in the current folder for printing at a later time.

8. Create envelopes with the vendor’s address.

9. Save the merged envelope documents in the current folder for printing at a later time.

Lesson Labs OTS Training


Word 2013: Mail Merge and Macros | 43

Lesson Lab 2-1


Using Macros

Activity Time: 15 minutes

Data Files
C:\091025Data\Using Macros\Salaries.docx

Scenario
It is time for the annual salary review for staff. Each store is providing the main office with a list of
the employees, their current salaries, and the proposed new salaries. The original form does not have
dollar signs in front of the salaries. When the store president is reviewing this information, he would
like to see the dollar signs. Also, some of the lists are lengthy and it is easy to lose your place. He
would like the tables formatted with banded rows. You have a small table of salaries you would like
to format for his approval before you do the rest of the tables. You realize this could take some time
until you remember that you could do the formatting with macros.

1. From C:\091025Data\Using Macros, open Salaries.docx.

2. Begin recording a macro that adds a $ in front of the Current Salary and New Salary in the first row.

3. Assign the macro to an unassigned keyboard shortcut.

4. Stop the recording.

5. Use the macro to add dollar signs to the rest of the salaries in the table.

6. Copy the table and paste the copy below the current table as a separate table. (If you paste it directly
below the current table, it will become part of that table, so insert a blank line between the two tables.)

7. Begin recording a macro that applies a banded table style to the table.

8. Assign the macro to an unassigned keyboard shortcut.

9. Stop the recording.

10. Use the macro to apply the table style to the second table.

11. Save the file in the current folder as My Salaries

Towson University Lesson Labs

You might also like