
When a keystroke causes the focus to move from one control to another.īACKSPACE is part of the ANSI character set, but DELETE is not.CTRL combined with any special characterĪ KeyPress event does not occur under the following conditions:.CTRL combined with a character from the standard alphabet.This event also occurs if you send an ANSI keystroke to a form or control by using either the SendKeys action in a macro or the SendKeys statement in Visual Basic.Ī KeyPress event can occur when any of the following keys are pressed: The event can occur either before or after the key is released. The KeyPress event occurs when the user presses a key that produces a typeable character (an ANSI key) on a running form while the form or a control on it has the focus. An integer value that represents a standard numeric ANSI key code.

The KeyPress event syntax has these parts: Part

Private Sub object _ KeyPress( ByVal KeyANSI As MSForms.ReturnInteger) Occurs when the user presses an ANSI key.
