Word Lesson 16

advertisement
Word Lesson 16
Working with Macros
Microsoft Office 2010
Advanced
1
Cable / Morrison
Objectives

Word Lesson 16

Create a macro-enabled document.
Name, store, record, and run a macro.
Choose a macro security setting.
Create a document template to store macros.

2
Cable / Morrison

Microsoft Office 2010 Advanced
Objectives (continued)

Word Lesson 16

Create shortcuts to run macros.
Edit macros.
Copy, delete, and rename macro projects.
Add a digital signature to a macro project.

3
Cable / Morrison

Microsoft Office 2010 Advanced
Vocabulary

Word Lesson 16

code
macro
macro project
VBA (Visual Basic for Applications)
virus

4
Cable / Morrison


Microsoft Office 2010 Advanced
Understanding Macros
Word Lesson 16

5
A macro is a group of sequential commands
and actions combined as a single command
to automatically complete a task.
–
–
Word provides numerous ready to use macros.
Creating your own macros enables you to
automate repetitive tasks.
Cable / Morrison
Microsoft Office 2010 Advanced
Understanding Macros (continued)
Word Lesson 16

6
Code is a set of instructions and data for a
computer program.
–

Code that Word creates is for VBA (Visual Basic
for Applications).
VBA (Visual Basic for Applications) is a
computer programming language and
environment designed for use within Office
and other Microsoft applications.
Cable / Morrison
Microsoft Office 2010 Advanced
Creating and Storing Macros in a
Document
Word Lesson 16

7

You can store macros in a document or in a
template.
When stored in a document, macros are only
available for that document.
Cable / Morrison
Microsoft Office 2010 Advanced
Creating and Storing Macros in a
Document (continued)

Word Lesson 16

Creating a Macro-Enabled Document
When you store a macro in a document, the
document must be saved in macro-enabled
document format.
Default format for a Word document has the
file extension .docx.
Format for a macro-enabled document has
the file extension .docm.

8
Cable / Morrison

Microsoft Office 2010 Advanced
Creating and Storing Macros in a
Document (continued)

Word Lesson 16

9
Naming and Storing a Macro
Before recording a macro, you must name
the macro and assign a location to store it.
–
–
–
Macro name must begin with a letter and can
contain up to 80 letters and numbers.
Unless you specify a different location, Word
saves macros in the Normal (*.dotm) template.
You can save the macro to the normal template,
the current document, or a document template.
Cable / Morrison
Microsoft Office 2010 Advanced
Creating and Storing Macros in a
Document (continued)

Word Lesson 16

10
Recording the Macro Actions
Plan the actions required to perform the task
before you begin recording a macro.
–
–
Any mistakes and corrections you make as you
record will be saved in the macro.
Make every effort to avoid prompts Word might
display that require a response from you.
Cable / Morrison
Microsoft Office 2010 Advanced
Creating and Storing Macros in a
Document (continued)
Recording the Macro Actions (continued)
Word Lesson 16

Record Macro dialog box
11
Cable / Morrison
Microsoft Office 2010 Advanced
Running Macros
Word Lesson 16

12


A virus is a computer program designed to
replicate itself; often causes damage to
computer data.
Sometimes viruses are stored in macros.
To counter potential corruption due to a
virus, Word offers several security levels for
running macros.
Cable / Morrison
Microsoft Office 2010 Advanced
Running Macros (continued)
Choosing a Macro Security Setting
Word Lesson 16

Macro security settings
13
Cable / Morrison
Microsoft Office 2010 Advanced
Running Macros (continued)

Word Lesson 16

14

Running a Macro
You can run your macro by opening the
Macros dialog box.
Before applying the macro, be sure to select
the appropriate text or reposition the
insertion point.
Cable / Morrison
Microsoft Office 2010 Advanced
Creating a Document Template to
Store Macros
Word Lesson 16

15

When stored in Normal.dotm template,
macros are available to all users of the
computer for all documents and at any time.
When macros are stored in a document
template, they are available only when the
document template is global or is attached to
a document.
Cable / Morrison
Microsoft Office 2010 Advanced
Creating and Deleting Macro
Shortcuts
Word Lesson 16

16


You have the option to assign a keyboard
shortcut or a button to a macro.
You cannot assign a shortcut key
combination and a button at the same time.
If you no longer use a macro, you can delete
the shortcut.
Cable / Morrison
Microsoft Office 2010 Advanced
Creating and Deleting Macro
Shortcuts (continued)
Word Lesson 16


Creating a Macro with a Keyboard
Shortcut
You must choose a
key combination
that is not already
assigned to other
commands or
functions.
Customize Keyboard dialog box
17
Cable / Morrison
Microsoft Office 2010 Advanced
Creating and Deleting Macro
Shortcuts (continued)

Word Lesson 16


Creating a Macro with a Button Shortcut
When you create a button shortcut for a
macro, it is added to the Quick Access
Toolbar.
When recording a macro:
–
–
18
You can use the mouse to choose commands
and click buttons.
You cannot record mouse movements within the
document window; you must use keystrokes.
Cable / Morrison
Microsoft Office 2010 Advanced
Creating and Deleting Macro
Shortcuts (continued)
Word Lesson 16


Creating and Deleting Shortcuts for
Existing Macros
You can easily
create shortcuts for
existing macros,
and customize
button icons.
Customize Keyboard dialog box showing
available macros and assigned keys
19
Cable / Morrison
Microsoft Office 2010 Advanced
Editing Macros
Word Lesson 16

20

Generally the easiest way to change a macro
is to record it again.
If the macro is complex and the changes you
want to make are minor, consider editing the
macro code.
–
You can edit the code in the Visual Basic Editor
(VBE) window.
Cable / Morrison
Microsoft Office 2010 Advanced
Copying, Deleting, and Renaming
Macro Projects
Word Lesson 16

21

When macros are stored in a document or in
a template, they are stored as a collection in
a macro project.
Options in the Organizer dialog box enable
you to copy, delete, and rename macro
projects.
Cable / Morrison
Microsoft Office 2010 Advanced
Signing a Macro Project
Word Lesson 16

22
Signing the macro project by adding a digital
signature will enable users who run the
macro to identify its creator and be assured
that the macro has not been altered.
Cable / Morrison
Microsoft Office 2010 Advanced
Restoring Settings
Word Lesson 16

23
It’s good practice to review the settings you
have customized before ending a Word
session.
–
For example, if you don’t want the changes to
affect future documents, it is easier to restore
original settings before exiting Word.
Cable / Morrison
Microsoft Office 2010 Advanced
Word Lesson 16
Summary
24
In this lesson you learned:
 You can store a macro in a document or in a
template. When stored in a document,
macros are only available for that document.
 When you create a macro, you record the
sequence of actions necessary to perform a
task.
Cable / Morrison
Microsoft Office 2010 Advanced
Summary (continued)
Word Lesson 16

25

Word enforces a security level for running
macros. Depending on the security level, you
may need to enable macros when you open
a document.
To make macros available for other
documents, you can store them in the normal
template or in a document template.
Cable / Morrison
Microsoft Office 2010 Advanced
Summary (continued)
Word Lesson 16

26

To create shortcuts to run a macro, you can
assign a shortcut key combination or you can
add a new button to the Quick Access
Toolbar.
To run a macro, you can use the Macros
dialog box or a keyboard or button shortcut.
Cable / Morrison
Microsoft Office 2010 Advanced
Summary (continued)
Word Lesson 16

27

When you want to change a macro, you can
re-record it or you can edit it in the Microsoft
Visual Basic Editor.
You can copy macro projects to make them
available to other documents and users.
When you no longer need a macro, you can
delete it from the macro project.
Cable / Morrison
Microsoft Office 2010 Advanced
Summary (continued)
Word Lesson 16

28

You can rename macro project groups to
help organize your macros.
When sharing macros with others, you
should sign the macro project by adding a
digital signature.
Cable / Morrison
Microsoft Office 2010 Advanced
Download