Objects and Events

Some of the objects in the Office object hierarchy can respond to events. Many events correspond to something the user does, such as opening a file, modifying some data, clicking with the mouse, or hitting a key. Other events are caused by code or by the system. Events are easy to use because the actual task of detecting them is taken care of automatically. All you need to do is decide which events your program should respond to.

To make use of events, you use event handlers (sometimes called event procedures). An event handler is a section of code that is automatically executed when the related event occurs. Event handlers are identified by two things: the name of the object that receives the event and the name of the event ...

Get Office® XP Development with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.