Executing a procedure when an event occurs

You might want a procedure to execute when a particular event occurs. Examples of events include opening a workbook, entering data into a worksheet, saving a workbook, clicking a CommandButton ActiveX control, and many others. A procedure that is executed when an event occurs is an event handler procedure. Event handler procedures are characterized by the following:

■ They have special names that are made up of an object, an underscore, and the event name. For example, the procedure that is executed when a workbook is opened is Workbook_Open.

■ They are stored in the Code module for the particular object.

CROSS- Chapter 19 is devoted to event handler procedures.


0 0

Post a comment