Share via


Application-Level Events

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

When you create a new Microsoft® Visual Basic® for Applications (VBA) project in Microsoft® Word or Microsoft® Excel, the project contains, by default, a class module bound to the application's current document. For example, Word creates a module for the ThisDocument object and Excel creates a module for the ThisWorkbook object. In Microsoft® Outlook®, because you use VBA to work with the application, the VBA project contains a class module called ThisOutlookSession, which is pre-bound to the Outlook Application object. As a result, all application-level events are available to you in the Visual Basic Editor Procedures drop-down list when you click the Application object in the Object drop-down list.

There are six events associated with the Application object that you can use to run custom VBA procedures. For example, you could use the Startup event to call custom procedures to customize the Outlook workspace or to create or display custom command bars or command bar controls. You could use the NewMail event procedure to call custom procedures that implement your own rules for handling incoming mail. These events are somewhat self-explanatory, and you can get complete documentation for each event by searching the Microsoft Outlook Visual Basic Reference Help index for the name of the event.

See Also

Understanding Events in Outlook | Item-Level Events