Student Guide M6
Student Guide M6
40570A
Microsoft Word expert 2019
Module 6: Creating and managing macros
Creating and managing macros
Contents
Contents..............................................................2
Module overview.............................................3
Description....................................................3
Scenario..........................................................3
Cornerstone..................................................4
Lesson 1: Recording simple macros.........5
Overview.........................................................5
Warm-up........................................................5
Topic 1: Run existing simple macros...6
Activity: Show and tell..........................7
Try-it: Run existing simple macros. .8
Topic 2: Record a new simple macro. .8
Record a macro.......................................9
Record a macro with a button........11
Record a macro with a keyboard shortcut 14
Activity: Show me how......................17
Try-it: Record a new simple macro18
Try-it 1......................................................18
Try-it 2......................................................18
Try-it 3......................................................19
Topic 3: Save a macro-enabled document 20
Activity: Pose a challenge.................20
Try-it: Save a macro-enabled document 21
Wrap-up.......................................................21
Lesson 2: Editing and copying macros. 23
Overview......................................................23
Warm-up.....................................................23
Topic 1: Edit simple macros..................24
2
Creating and managing macros
Module overview
Description
This module consists of two lessons designed to help you learn how to use some of the
advanced features of Microsoft Word 2019. By the end of this module, you'll be able to
run, record, edit, and copy macros.
The following table outlines the lessons in this module and their corresponding learning
objectives.
3
Creating and managing macros
Editing and Edit a simple macro and copy the macro to 4.2.3
copying other documents and templates. 4.2.4
macros
Scenario
Customers participating in Munson's Pickles and Preserves Farm Community Supported
Agriculture (CSA) Program can submit recipes to the Annual Recipe Contest. Selected
recipes are included in the Annual Munson's Pickles and Preserves Farm Cookbook.
Entries are submitted on digital recipe cards and must be formatted prior to publication.
You'll record a macro (a shortcut) to apply the correct formatting to the submitted
recipes before adding them to the Cookbook template.
4
Creating and managing macros
Cornerstone
Munson’s Pickles and Preserves Farm would like to be able to quickly create a letter
document that includes their logo, the current date, and an address placeholder. You
think that a macro would be great way to accomplish this task! You'll create a new
macro that creates a new document, inserts the current date, and includes an address
placeholder, so that your coworkers can quickly create a new document with these
elements. You'll then make the new macro available in all new Word documents.
5
Creating and managing macros
Warm-up
Use these questions to find out what you already know about this lesson’s topics:
1. Macros are used to:
Select the correct option.
a. Lock a document.
b. Automatically recover documents.
c. Perform repetitive work.
d. Do work that is not performed daily.
2. If you create a document with a macro and you want to save the document to
include the macro, you must save the document in which file format?
Select the correct option.
a. .docx
b. .doct
c. .dotx
d. .docm
6
Creating and managing macros
3. A macro that has been assigned a keyboard shortcut can be run in which of the
following?
Select all that apply.
a. A blank document
b. An existing document
c. A template
d. A macro-enabled document
7
Creating and managing macros
2. In the list under Macro name, select the macro, as depicted in the following
screenshot.
3. Select Run.
Additional information
To review the information on running a macro, go to: Create or run a
macro
8
Creating and managing macros
Resources required
None
Activity instructions
Participate in the activity by following these instructions:
1. Observe the teacher demonstrating how to open a macro-enabled document and
run existing macros.
2. Ask the teacher clarifying questions.
3. Participate in the discussion.
Resources
You'll need the following resources for this try-it:
Open L1_T1_try_macro_demo.docm in this lesson’s Learning Activity Resources.
Instructions
The following are the general tasks that you must perform during this try-it:
1. When opening the file, enable the macros.
2. Use the Macro list to run the Welcome macro.
3. Use the Macro list to run the Demo macro.
4. In the next paragraph after the sentence ending in …using macros, enter and select
the sentence I love macros, then run the Format_Macro macro from the Macro list.
5. Discuss your observations with a classmate.
9
Creating and managing macros
Record a macro
1. From the View tab, Macros group, select Macros, then choose Record Macro…, as
depicted in the following screenshot.
n
Figure 3: The Record Macro option
2. From the Record Macro dialog box in the Macro name box, enter a name for the
macro, as depicted in the following screenshot.
Figure 4: The Macro name option, in the Record Macro dialog box
10
Creating and managing macros
3. To use this macro in any new document, in the Store macro in box, select All
Documents (Normal.dotm), as depicted in the following screenshot.
Figure 5: The Record Macro dialog box, with the Store macro in option
7. Access the macro in the Macros list from the View tab, Macros group, then select
View Macros. In the list under Macro name, select the macro.
11
Creating and managing macros
2. From the Record Macro dialog box, in the Macro name box, enter a name for the
macro, as depicted in the following screenshot.
3. To use this macro in any new document, in the Store macro in box, select All
Documents (Normal.dotm), as depicted in the following screenshot.
12
Creating and managing macros
4. In the Assign macro to area, select Button, as depicted in the following screenshot.
13
Creating and managing macros
10. Select OK again to exit the Customize the Quick Access Toolbar window, as
depicted in the following screenshot.
Figure 13: The Modify Button options
11. Record the steps in the macro by selecting the commands or entering the text for
each step in the task. Word records your actions.
o Use the keyboard to select text, by using the SHIFT+arrow keys, while recording
macros. Macros don’t record selections made with a mouse or other pointing
device.
12. When the steps in the macro are complete, to stop recording, go to the View tab,
Macros group, select Macros and then Stop Recording, as depicted in the
following screenshot.
14
Creating and managing macros
13. The button for your macro appears on the Quick Access Toolbar.
14. To run the macro, select the button from the Quick Access Toolbar.
2. From the Record Macro dialog box in the Macro name box, enter a name for the
macro, as depicted in the following screenshot.
15
Creating and managing macros
3. To use this macro in any new document, in the Store macro in box, select All
Documents (Normal.dotm), as depicted in the following screenshot.
16
Creating and managing macros
5. Select a combination of keys in the Press new shortcut key box, as depicted in the
following screenshot.
17
Creating and managing macros
10. When the macro steps are complete, to stop recording, go to the View tab, Macros
group, and select Macros then Stop Recording, as depicted in the following
screenshot.
Additional information
To review the additional information on running a macro, go to:
Create or run a macro
Resources required
None
18
Creating and managing macros
Activity instructions
Participate in the activity by following these instructions:
1. Observe the teacher demonstrating how to record macros.
2. Ask the teacher clarifying questions.
3. Participate in the discussion.
Try-it 1
In this try-it, you'll record macros: one to run from the macro list and one from a
keyboard shortcut.
Resources
You'll need the following resources for this try-it:
None
Instructions
The following are the general tasks that you must perform during this try-it:
1. Open a blank document.
2. Record a macro to run from the macro list that will create a header with your name
to the left, the class name in the center, and the date that updates automatically to
the right, then close the Header and Footer toolbar.
3. Record a macro to run from a keyboard shortcut that will create a footer with the
page numbers in the center, then close the Header and Footer toolbar.
4. Test your macros to ensure that they run properly.
5. Save the document and keep it open for the next topic.
Try-it 2
In this try-it, you'll record macros: one to run from the macro list, one to run from a
keyboard short cut, and one to run from a button.
19
Creating and managing macros
Resources
None
Instructions
The following are the general tasks that you must perform during this try-it:
1. Open a blank document.
2. Record a macro to run from the macro list that will create a header with your name
to the left, the class name in the center, and the date that updates automatically to
the right, and then close the Header and Footer toolbar.
3. Record a macro to run from a keyboard shortcut that will create a footer with the
page numbers in the center, and then close the Header and Footer toolbar.
4. Record a macro to run from a button on the Quick Access Toolbar that will select all
the text entered in your document, and then format text to your liking.
5. Save the document and keep it open for the next topic.
Try-it 3
In this try-it, you'll record macros: one to run from the macro list, one to run from a
keyboard short cut, one to run from a button, and one to run from a custom ribbon
group.
Resources
None
Instructions
The following are the general tasks that you must perform during this try-it:
1. Open a blank document.
2. Record a macro to run from the macro list that will create a header with your name
to the left, the class name in the center, and the date that updates automatically to
the right, and then close the Header and Footer toolbar.
3. Record a macro to run from a keyboard shortcut that will create a footer with the
page numbers in the center, and then close the Header and Footer toolbar.
4. Record a macro to run from a button on the Quick Access Toolbar that will format
text to your liking.
20
Creating and managing macros
5. Record a macro to run from a button in a custom ribbon group that will insert a
Quick Part.
6. Save the document and keep it open for the next topic.
Resources required
None
21
Creating and managing macros
Activity instructions
Participate in the activity by following these instructions:
1. Think about when you opened a macro-enabled document and when you have
saved documents in another file format.
2. Determine the steps required to save a macro-enabled document.
3. Share your ideas with a classmate.
4. Be prepared to share with the class.
Resources
None
Instructions
The following are the general tasks that you must perform during this try-it:
1. Open a blank document.
2. Save your document as a macro-enabled document.
3. Close the document.
Wrap-up
Use these questions to check what you learned in this lesson:
1. Macros can be assigned to run from:
Select all that apply.
a. The Macros list.
b. A keyboard shortcut.
c. A button on the Quick Access Toolbar.
d. A button on a custom ribbon group.
22
Creating and managing macros
2. To record selecting text, you must select the text by using Select here to enter text..
Fill in the blank space.
3. To record macros, you can use the Select here to enter text. tab or the Select here
to enter text. tab.
Fill in the blank spaces.
23
Creating and managing macros
Warm-up
Use these questions to find out what you already know about this lesson’s topics:
1. Macros are created by using which programing language?
Select the correct option.
a. HTML
b. CSS
c. Visual Basic
d. Java
2. You can access the macro security settings from which tabs?
Select all that apply.
a. File
b. Insert
c. View
d. Developer
3. You can open the Visual Basic Editor directly from which tab?
Select all that apply.
a. Insert
b. Design
c. Developer
24
Creating and managing macros
d. Review
2. From the Macros dialog box, select Edit, as depicted in the following screenshot.
3. A Microsoft Visual Basic for Applications window will open. Locate the macro from
the list by identifying the macro name next to the Sub command (example: Sub
Demo ( )).
4. Review the code and make the changes that you wish.
25
Creating and managing macros
You don’t need to know Visual Basics for Applications to edit a simple macro. Read
through each line then identify the steps to edit.
This is example code for setting the font to Arial Rounded MT Bold:
Selection.Font.Name = "Arial Rounded MT Bold"
To change the font, change the name in the code, as in this example:
Selection.Font.Name = "Segoe UI"
Additional information
To review additional information on Visual Basics for Applications,
go to: Getting started with VBA in Office
Resources required
You'll need the following resources for this activity:
None
Activity instructions
Participate in the activity by following these instructions:
1. Create a simple macro by following your teacher’s demonstration.
2. Review the code in the Microsoft Visual Basic for Applications window.
3. Edit the lines of code by following your teacher’s demonstration.
4. Close the Microsoft Visual Basic for Applications window.
5. Run the macro to check your changes.
6. Ask the teacher clarifying questions.
7. Participate in the discussion.
26
Creating and managing macros
Try-it 1
In this try-it, you'll record a simple macro, then edit it in VBA.
Resources
None
Instructions
The following are the general tasks that you must perform during this try-it:
1. Record a simple macro in the current document only.
2. Edit the code.
3. Run the macro to check your results.
4. Save as a macro-enabled document and keep the document open for the next topic.
Try-it 2
In this try-it, you'll review an existing macro code to determine the outcome.
Resources
You'll need the following resources for this try-it:
Open L2_T1_try2_starter.docm in this lesson’s Learning Activity Resources.
Instructions
The following are the general tasks that you must perform during this try-it:
1. Go through the macro code before running the macro.
2. Determine what you think will happen when you run the macro.
3. Share your thoughts with a classmate.
4. Run the macro.
5. Return to the macro code and make a few edits.
6. Run the macro to check your results.
7. Save the document and keep it open for the next topic.
27
Creating and managing macros
2. From the Macros dialog box, select Organizer, as depicted in the following
screenshot.
28
Creating and managing macros
3. From the Organizer dialog box, Macro Project Items tab, select the file that you
want to copy the macro from by using the drop-down menu under the Macro
Project Items available in:.
4. Then select the file you want to copy the macro to by using the drop-down menu
under the second Macro Project Items available in:.
5. Select the Macro Project item from the first document, select Copy, then Close. The
screenshot below depicts the Demo document copying the NewMacros to the
Sample document, as depicted in the following screenshot.
29
Creating and managing macros
Resources required
None
Activity instructions
Participate in the activity by following these instructions:
1. Think back to when you copied styles from one document to another.
2. Explore the Organizer dialog box by going to the View tab, Macros group, and
selecting View Macros.
3. Then determine the steps required to copy the macros from one document to
another.
4. Be prepared to share your ideas with the class.
5. Observe as your teacher demonstrates how to copy macros from the Visual Basic
Editor.
6. Ask the teacher clarifying questions.
7. Participate in the discussion.
30
Creating and managing macros
Try-it 1
In this try-it, you'll copy macros from one document to another by using the Organizer.
Resources
You'll need the following resources for this try-it:
The file from the previous try-it or open the L2_T2_try1_starter.docm in this lesson’s
Learning Activity Resources.
Instructions
The following are the general tasks that you must perform during this try-it:
1. Create a new document.
2. Copy the macros from your file to the new document by using the Organizer.
3. Save and close the documents.
Try-it 2
In this try-it, you will copy macros from one document to another by using the Visual
Basic Editor.
Resources
You'll need the following resources for this try-it:
The file from the previous try-it or open the L2_T2_try2_starter.docm in this lesson’s
Learning Activity Resources.
Instructions
The following are the general tasks that you need to perform during this try-it:
1. Create a new document.
2. Copy the macros from your file to the new document by using the using the Visual
Basic Editor.
3. Save and close the documents.
31
Creating and managing macros
Wrap-up
Use these questions to check what you learned in this lesson:
1. You can copy a macro to:
Select all that apply.
a. .docx
b. .docm
c. .txt
d. .dotm
2. You can edit a macro from Select here to enter text. or Select here to enter text..
Fill in the blank spaces.
3. What is an example of VBA code? Select here to enter text..
Fill in the blank space.
Glossary
Macro A series of commands and instructions that you group together
as a single command to accomplish a task automatically.
32
Creating and managing macros
Cornerstone
Overview
In this Cornerstone, you'll create and edit macros in a document, add the new macros to
a keyboard shortcut button, and then make them available from the Quick Access
Toolbar and a custom ribbon group.
Objectives
The following table outlines the Cornerstone objectives and their corresponding MOS
exam objectives.
Duration
50 minutes
Instructions
1. Complete the tasks for each file.
2. When saving your file, add your name to the end of the filename; for example,
Background_Espino. Follow your teacher’s directions for where to save your files.
3. When you’re done with the Cornerstone, assess your completion and enter the
points you think you earned within the task lists below. You can ask your teacher for
help if you need it.
Tasks
In this Cornerstone, you'll work with one file with six tasks.
33
Creating and managing macros
File 1: Cornerstone_recipe_starter.docx
Task: Record a button macro (6 points)
1. Record a button macro named Cornerstone in the normal template that includes
each of the following tasks: (5 points) (Exam objective 4.2.1 and 4.2.2)
a. Create a new document.
b. Paste the text that you select from the cornerstone_recipe_starter.doc file.
c. Select all text and format it with Arial font, 16pt, Bold.
2. Run your macro. (1 point) (Exam objective n/a)
Points scored: Select here to enter text. / 6
34
Creating and managing macros
35