28
Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Embed Size (px)

Citation preview

Page 1: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Word Lesson 16Working with Macros

Microsoft Office 2010 Advanced

Cable / Morrison1

Page 2: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced2

Objectives

Create a macro-enabled document. Name, store, record, and run a macro. Choose a macro security setting. Create a document template to store macros.

22

Page 3: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Objectives (continued)

Create shortcuts to run macros. Edit macros. Copy, delete, and rename macro projects. Add a digital signature to a macro project.

3

Page 4: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced4

Vocabulary

code macro macro project VBA (Visual Basic for Applications) virus

44

Page 5: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced5

Understanding Macros

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.

Page 6: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Understanding Macros (continued)

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.

6

Page 7: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Storing Macros in a Document

You can store macros in a document or in a template.

When stored in a document, macros are only available for that document.

7

Page 8: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Storing Macros in a Document (continued)

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

Page 9: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Storing Macros in a Document (continued)

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.

9

Page 10: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Storing Macros in a Document (continued)

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.

10

Page 11: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Storing Macros in a Document (continued)

11Record Macro dialog box

Recording the Macro Actions (continued)

Page 12: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Running Macros

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.

12

Page 13: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Running Macros (continued)

Choosing a Macro Security Setting

13Macro security settings

Page 14: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Running Macros (continued)

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.

14

Page 15: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating a Document Template to Store Macros

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.

15

Page 16: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Deleting Macro Shortcuts

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.

16

Page 17: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Deleting Macro Shortcuts (continued)

Creating a Macro with a Keyboard Shortcut

17Customize Keyboard dialog box

You must choose a key combination that is not already assigned to other commands or functions.

Page 18: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Deleting Macro Shortcuts (continued)

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:– You can use the mouse to choose commands and

click buttons.– You cannot record mouse movements within the

document window; you must use keystrokes.18

Page 19: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Creating and Deleting Macro Shortcuts (continued)

Creating and Deleting Shortcuts for Existing Macros

19

Customize Keyboard dialog box showing available macros and assigned keys

You can easily create shortcuts for existing macros, and customize button icons.

Page 20: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Editing Macros

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.

20

Page 21: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Copying, Deleting, and Renaming Macro Projects

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.

21

Page 22: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Signing a Macro Project

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.

22

Page 23: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Restoring Settings

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.

23

Page 24: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Summary

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.

24

Page 25: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Summary (continued)

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.

25

Page 26: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Summary (continued)

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.

26

Page 27: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Summary (continued)

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.

27

Page 28: Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1

Wo

rd L

es

so

n 1

6

Cable / Morrison Microsoft Office 2010 Advanced

Summary (continued)

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.

28