Writing an Outlook macro
A macro is any public subroutine in a code module. A function or a private subroutine cannot be a macro, and a macro cannot be located in a class or form module.
To create a new macro
- In Outlook, point to Macro on the Tools menu, and then click Visual Basic Editor.
- In the Project window, double-click the module you want to contain the macro.
- On the Insert menu, click Procedure.
- In the Name box, type a name for the macro. The name cannot contain spaces.
- Click OK.
The template for the macro subroutine appears in the code module window.
- Type the code you want to run in the body of the subroutine.
For more information about using the Visual Basic Editor, see the Visual Basic Editor Help.
Once you’ve created a macro, you can create a menu item or toolbar button that will run the macro when you click it.