Microsoft Office Tutorials and References
In Depth Information
Topic A: Recording and running macros
Viewing macro scripts
When you create a macro by using the recorder, your steps are translated into Visual
Basic code. You can view and edit this code in the Microsoft Visual Basic for
Applications editor. The macro code starts with a Sub statement followed by the macro
name, and ends with an End Sub statement.
The code can include comment entries. For example, you can add the name and
description of a macro as comments in the macro code. Well-written comments can be
helpful in understanding or debugging the macro. When the code executes, Word
ignores these comment entries.
To view a macro’s code:
On the View tab, in the Macros group, click the top portion of the Macros button
to open the Macros dialog box.
In the Macro name box, select the desired macro.
Click Edit to open the Microsoft Visual Basic for Applications editor, shown in
Exhibit 3-2: The Microsoft Visual Basic for Applications window