Microsoft Office Tutorials and References
In Depth Information
Understanding UserForm Events
Event
Description
Error
Occurs when the control detects an error and can’t return the error
information to a calling program.
Exit
Occurs immediately before a control loses the focus to another control on the
same form.
KeyDown
Occurs when the user presses a key and the object has the focus.
KeyPress
Occurs when the user presses any key that produces a typeable character.
KeyUp
Occurs when the user releases a key and the object has the focus.
SpinDown
Occurs when the user clicks the lower (or left) SpinButton arrow.
SpinUp
Occurs when the user clicks the upper (or right) SpinButton arrow.
A user can operate a SpinButton control by clicking it with the mouse or (if the control has the
focus) by using the up-arrow and down-arrow keys.
Mouse-initiated events
When the user clicks the upper SpinButton arrow, the following events occur in this precise order:
1.
Enter (triggered only if the SpinButton did not already have the focus)
2.
Change
3.
SpinUp
Keyboard-initiated events
The user can also press Tab to set the focus to the SpinButton and then use the arrow keys to
increment or decrement the control. If so, the following events occur (in this order):
1.
Enter
2.
KeyDown
3.
Change
4.
SpinUp (or SpinDown )
5.
KeyUp
What about changes via code?
The SpinButton control can also be changed by VBA code — which also triggers the
appropriate event(s). For example, the following statement sets the SpinButton1 Value property to 0
and also triggers the Change event for the SpinButton control — but only if the SpinButton
value was not already 0 :
SpinButton1.Value = 0
 
Search JabSto ::




Custom Search