About event handler procedures

After the UserForm is displayed, the user interacts with it — selecting an item from a ListBox, clicking a CommandButton, and so on. In official terminology, the user causes an event to occur. For example, clicking a CommandButton raises the Click event for the CommandButton. You will need to write procedures that are executed when these events occur. These procedures are sometimes known as event handler procedures.

Event handler procedures must be located in the Code window for the UserForm. However, your event handler procedure can call another procedure that's located in a standard VBA module.

Your VBA code can change the properties of the controls while the UserForm is displayed (that is, at runtime). For example, you could assign to a ListBox control a procedure that changes the text in a Label when an item is selected. This type of manipulation will become clearer later in this chapter.

Was this article helpful?

0 0

Post a comment