KeyDown, KeyUp Events
Syntax
Sub ControlName_KeyDown(KeyCode, Shift)
Sub ControlName_KeyUp(KeyCode, Shift)
Applies To
Purpose
KeyDown fires when you press a key while the control has the input focus.
KeyUp fires when you release a key while the control has the input focus.
Parameters
KeyCode As Integer
A code representing the pressed key. This code represents the key rather than the ASCII value of the key. For example, pressing the <A> key produces the value 65. Pressing <#> , or <Shift-3> , produces the code for "3".
Shift As Integer
The Shift argument can be any combination of the following values: 1 for <Shift> , 2 for <Ctrl> , or 4 for <Alt> . For example, if you press the <Shift> and <Ctrl> keys, the value is 3 (1 + 2).