This event occurs when a user releases a key while an object has the focus.
Private Sub object_KeyUp(keycode, shift)
The object with the focus receives all keystrokes. A form can have the focus only if it has no visible and enabled controls.
If the KeyPreview property is set to True, a form receives these events before controls on the form receive the events. Use the KeyPreview property to create global keyboard-handling routines.
Use the KeyUp event procedure if you need to respond to both the pressing and releasing of a key.
Do not invoke the KeyUp event for the following keys:
The following table shows the values for the shift constants.
Constant |
Value |
Description |
vbShiftMask | 1 | SHIFT key bit mask. |
vbCtrlMask | 2 | CTRL key bit mask. |
vbAltMask | 4 | ALT key bit mask. |
The constants act as bit masks that you can use to test for any combination of keys.
To interpret ANSI characters, use the KeyPress event.