View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Stefan Mueller[_2_] Stefan Mueller[_2_] is offline
external usenet poster
 
Posts: 20
Default How to intercept each pressed key

In real VB I can intercept each pressed key with the following code
before e.g. the character of the pressed key is added to a TextBox:

Private Sub Form_Load()
Me.KeyPreview = True
...
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
MsgBox ("The key " & KeyCode & " has been pressed.")
End Sub

Is there a way to do something similar in VBA (e.g. Excel)?