A UserForm supports quite a few events, and each control placed on a UserForm has its own set of events. Table 19-5 lists the UserForm events that you can use.
| Event | Action That Triggers the Event |
|---|---|
| Activate | The UserForm is activated. |
| AddControl | A control is added at runtime. |
| BeforeDragOver | A drag-and-drop operation is in progress while the pointer is over the form. |
| BeforeDropOrPaste | The user is about to drop or paste data: that is, when the user has released the mouse button. |
| Click | A mouse is clicked while the pointer is over the form. |
| DblClick | A mouse is double-clicked while the pointer is over the form. |
| Deactivate | The UserForm is deactivated. |
| Error | A control detects an error and cannot return the error information to a calling program. |
| Initialize | The UserForm is about to be shown. |
| KeyDown | A key is pressed. |
| KeyPress | The user presses any ANSI key. |
| KeyUp | A key is released. |
| Layout | A UserForm changes size . |
| MouseDown | A mouse button is pressed. |
| MouseMove | The mouse is moved. |
| MouseUp | A mouse button is released. |
| QueryClose | Occurs before a UserForm closes . |
| RemoveControl | A control is removed from the UserForm at runtime. |
| Resize | The UserForm is resized. |
| Scroll | The UserForm is scrolled. |
| Terminate | The UserForm is terminated . |
| Zoom | The UserForm is zoomed. |
| CROSS-REFERENCE | Many of the examples in Chapters 13 through 15 demonstrate event handling for UserForms and UserForm controls. |