Description
To run a macro when the KeyPress event occurs, set the OnKeyPress property to the name of the macro.
Remarks You can use a KeyPress macro to respond whenever the user presses an ANSI key while the focus is on a form or control. However, macros can't return the ANSI key code and determine which key was pressed, so you typically use event procedures with this event. You can use the CancelEvent action in a KeyPress macro to cancel the key or key combination. For example, you may want to disallow the entry of ANSI keystrokes in a control under certain conditions.See Also KeyPress event — event procedures.