How to Suppress a keystroke in VBA

jal

Registered User.
Local time
Yesterday, 22:50
Joined
Mar 30, 2007
Messages
1,709
How to Suppress a keystroke in VBA.

I have a textbox. When the user hits the plus sign (on the numeric keypad) , I would like to both
(1) Prevent the keystroke from falling AND
(2) Tab the user backward one control in the tab order.

I'm not sure how to do either 1 or 2 as yet. I realize it will be the keypress event or keydown event, but I don't know the syntax.
 
Code:
If KeyCode = 187 Then
  ' Move to a control.
  Me.TextBoxXYZ.SetFocus
  ' Eat the key.
  KeyCode = 0
End If

Regards,
Tim
 
Code:
If KeyCode = 187 Then
  ' Move to a control.
  Me.TextBoxXYZ.SetFocus
  ' Eat the key.
  KeyCode = 0
End If

Regards,
Tim

Perfect. Thank you !!
 

Users who are viewing this thread

Back
Top Bottom