Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Writing an Outlook Macro

Writing an Outlook Macro

Office 2007

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

  1. In Outlook, point to Macro on the Tools menu, and then click Visual Basic Editor.
  2. In the Project window, double-click the module you want to contain the macro.
  3. On the Insert menu, click Procedure.
  4. In the Name box, type a name for the macro. The name cannot contain spaces.
  5. Click OK.

    The template for the macro subroutine appears in the code module window.

  6. 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.

Community Additions

© 2015 Microsoft