280 likes | 379 Vues
Word Lesson 16 Working with Macros. Microsoft Office 2010 Advanced. Cable / Morrison. 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. 2. 2. Objectives (continued).
E N D
Word Lesson 16Working with Macros Microsoft Office 2010 Advanced Cable / Morrison
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. 2 2
Objectives (continued) • Create shortcuts to run macros. • Edit macros. • Copy, delete, and rename macro projects. • Add a digital signature to a macro project.
Vocabulary • code • macro • macro project • VBA (Visual Basic for Applications) • virus 4 4
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.
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.
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.
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.
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.
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.
Creating and Storing Macros in a Document (continued) • Recording the Macro Actions (continued) Record Macro dialog box
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.
Running Macros (continued) • Choosing a Macro Security Setting Macro security settings
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.
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.
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.
Creating and Deleting Macro Shortcuts (continued) • 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
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.
Creating and Deleting Macro Shortcuts (continued) • 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
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.
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.
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.
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.
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.
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.
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.
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.
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.