Freigeben über


Creating Events and Event Procedures

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.

As a VBA programmer, you understand how to handle form and control events. If you've programmed in Word or Excel, you may also have taken advantage of events on the ThisDocument, ThisWorkbook, or SheetN objects. These event procedures are simple to create — you just open the class module and construct the event procedure from the Object and Procedure drop-down lists in the Code window.

There are two additional ways to handle events from VBA code in an Office application. You can create event procedures for certain objects that provide built-in events but that don't have associated class modules. You can also create custom events for your own classes.