KeyDown

<< Click to Display Table of Contents >>

 

KeyDown

KeyDown(KeyCode, Shift)

This event occurs when a key is pressed, regardless of Screen focus.

Parameters of the KeyDown event

Name

Description

KeyCode

Integer identifying the ASCII character of the pressed key

Shift

Displays the shortcut key used with the pressed key. Possible values are 4: SHIFT key, 8: CTRL key, or 12: CTRL + SHIFT keys

 

The next script contains an example of using this event.

Sub Screen1_KeyDown(KeyCode, Shift)
  ' Displays a message box when
  ' a user presses a key
  MsgBox "Key code: " & KeyCode
End Sub

 

NOTE

For a list with all key codes available for the KeyCode parameter, please check the article Keys Enumeration on Microsoft Developer Network.

Was this page useful?