Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MS Word Chapter 22

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Chapter - 22

Automating Repetitive Tasks with Macros:

Automate Tasks Using Macros:


A macro is a series of commands and instructions that are recorded so that they can be
executed as a single command. Instead of manually performing a series of time-consuming,
repetitive actions in Word yourself; you can create a macro to perform the task for you. There
are two ways to create a macro: by recording them or by writing them in Word’s Visual Basic
programming language. This lesson explains the easy way to create a macro—by recording the
task(s) you want the macro to execute for you.

Show the Developer tab on the Ribbon:


The Developer tab must be displayed on the Ribbon in order to access and insert the macro
controls.

1. Click the File tab on the Ribbon and select Options.

The Word Options dialog box appears.

2. Click the Customize Ribbon tab.

The right column displays the tabs on the Ribbon and the groups and commands in each tab.

3. Select the Developer check box under Customize the Ribbon and click OK.

The Word Options dialog box closes, and the Developer tab is displayed on the Ribbon.

Create a Macro:
When you create or record a macro, imagine you’re being videotaped; everything is
recorded—all your commands, the data you enter, even any mistakes you make. Before
recording a macro, it’s helpful to write down a script that contains all the steps you want the
macro to record. Practice or rehearse your script a couple times, to make sure it works, before
you actually record it. If you do make a mistake while recording a macro, don’t worry—you
can always delete the existing macro and try again or edit the macro’s Visual Basic source code
to fix the mistake.

1. Click the Developer tab on the Ribbon and click the Record Macro button in the Code

group.

The Record Macro dialog box appears.

2. Enter a name for the macro.

Next you can enter a number of specifications for the macro, including assigning a keystroke
shortcut to the macro for easy access.

3. (Optional) Click the Keyboard button and in the Press new shortcut key box, press the

keystroke shortcut that you want to use. Click Close.

If the keystroke is not already assigned to another command, [unassigned] appears in the
dialog box.

You may also choose if you want to save the macro in the current document or template, or
enter a description for the macro.

4. Finish entering the macro information and click OK. Now the Record Macro dialog box
closes, and everything you do is recorded.

5. Perform the actions you want to include in your macro.

You can perform a command from the Ribbon, a keystroke shortcut, or a dialog box.

Tip: You cannot use the mouse to edit and select text as you normally would while recording a
macro—you have to use the keyboard instead. You still can use the mouse to access the
Ribbon, however.

Tip: Use the Pause Recording button if you need to stop the macro command progression
so you don’t have to start all over again.

6. Click the Stop Recording button in the Code group.

The macro is recorded and ready to use.


Other Ways to Stop Recording: Click the Stop Recording button on the status bar.

Playing and Deleting a Macro:


Once you have created a macro, you’re ready to use it in your documents.

Tip:

 If you see a Security Warning message beneath the Ribbon telling you that macros have been
disabled, click the Enable this content, and click OK.

Play a macro:

1. Click the Developer tab on the Ribbon and click the Macros button in the Code group.

The Macros dialog box appears. Here you can see the macros that are available in the
document.

Other Ways to View Macros: Press <Alt> + <F8>.

2. Select the macro you want to run and click the Run button.

The macro runs, performing the steps you recorded.

Other Ways to Run a Macro:


Click the button or press the keystroke shortcut assigned to the macro.

Delete a macro:
Delete a macro when it is no longer needed. This lowers the security threat of the document.

1. Click the Developer tab on the Ribbon and click the Macros button in the Code group.

The Macros dialog box appears.

2. Select the macro you want to delete and click the Delete button in the dialog box.

Another dialog box appears, asking if you really want to delete the macro.

3. Click Yes.
The macro is deleted.

You might also like