Microsoft Office Tutorials and References
In Depth Information
Other Ways to Run Macros
In addition to running a macro from the Macros dialog box, you can assign macros to your menus
and toolbars for easier access. This is explained later in this chapter.
n Edit: Open the VBA editor to edit the macro.
n Delete: Delete the macro.
To create a new macro, enter its name in the Macro Name box (the name must be unique for obvious
reasons) and click the Create button. Outlook opens the VBA Editor with the shell — that is, the first
and last lines — of the new macro in place, ready for you to add code.
The VBA Editor
The VBA Editor is where you create, edit, and debug macros. The editor is a powerful programming
tool and is designed to make your programming efforts as easy as possible. You can open the editor
from Outlook in several ways:
n Press Alt+F11 (press Alt+F11 again to return to Outlook).
n Select Macro from the Tools menu and then select Visual Basic Editor.
n From the Macros dialog box, select the Edit or Create command (as explained in the
The VBA Editor is shown in Figure 22.2. You learn more about the editor’s various tools and
commands in subsequent chapters; for now it’s enough for you to become familiar with the parts of the
n At the top left of the screen is the Project Explorer , where the editor lists the various
components of the Outlook VBA project.
n At the bottom left of the screen is the Properties window , where you view and edit the
properties of whatever object is currently selected. In the figure, there is only a single
property, but in other situations there will be dozens of properties listed here.
n The main part of the screen, at the top right, displays one or more editing windows. It’s
here that you enter and edit VBA code.
n At the bottom of the screen is the Immediate window , which you can use to debug macros.