When you record a macro, it's as though you've turned on a video camera that watches your keystrokes, mouse movements, and command selectionsthe macro recorder notes every move you make and converts your actions to programming code. After you name your macro and perform all the steps you want to automate, stop the recorder, and by using the name you've given the macro, you can run it at any time. A macro enables you to perform a virtually unlimited series of steps in just seconds. NOTE In earlier versions of Office, the Word, Excel, and PowerPoint programs didn't have features such as AutoCorrect and AutoText. Before these features existed, users created macros to correct common misspellings and turn abbreviations into words, phrases, and paragraphs. As Office evolves, the number of common tasks you'll need to automate by yourself will continue to decrease. Recording a MacroBefore you begin to record a macro, you need to do some planning. Think about where you are in the process of developing or running a presentation when the macro you're about to create is invoked. What situation must exist for the macro to be successful? If the macro formats existing slide content, the content must be displayed and selected before the macro is run. If the macro runs a slideshow, the presentation must be placed in the same folder where the macro was recorded. In short, set the stage for your macro to begin, and record it only when the scenario is appropriate. After you set the stage, record your macro by following these steps:
CAUTION Try to test your macros immediately, especially if you've developed them for others to use. This will prevent any unpleasant surprises when you or another user attempts to use the macro, and enables you to edit it as needed while the procedures are fresh in your mind. The process of running a macro is discussed later in this chapter.
Creating a Macro in the Visual Basic EditorIf you're familiar with VBA, you can build a macro without recording your steps as described in the previous section of this chapter. Instead, you can type the macro programming code directly in to an editing window provided by Office XP's Visual Basic Editor (see Figure 20.2). Figure 20.2. Even a novice VBA user can learn a lot from building and editing macro code in this window.
To enter the editor, select Tools, Macro, Visual Basic Editor, and then choose the macro you want to edit from the Declarations drop-down list (on the upper-right corner of the large module window). The editor consists of three separate windows each designed to assist you in the creation and editing of a macro:
Figure 20.3 shows the Module window with the parts of a simple formatting macro identified. Figure 20.3. A knowledge of VBA is required for building a macro from scratch in the Visual Basic Editor.
To create a macro in the Visual Basic Editor, follow these steps:
|