Understanding User Form Events

Each UserForm control (as well as the UserForm itself) is designed to respond to certain types of events, and these events can be triggered by a user or by Excel. For example, clicking a CommandButton generates a Click event for the CommandButton. You can write code that is executed when a particular event occurs.

Some actions generate multiple events. For example, clicking the upward arrow of a SpinButton control generates a SpinUp event and also a Change event. When a UserForm is displayed by using the Show method, Excel generates an Initialize event and an Activate event for the UserForm. (Actually, the Initialize event occurs when the UserForm is loaded into memory and before it is actually displayed.)

CROSS- Excel also supports events associated with a Sheet object, Chart objects,

REFERENCE and the ThisWorkbook object. I discuss these types of events in Chapter 18.

0 0

Post a comment