Microsoft KB Archive/79488

= Microsoft Knowledge Base =

Excel: ON.KEY Does Not Disable Macro Interruption with ESC Key
Last reviewed: July 16, 1997

Article ID: Q79488

The information in this article applies to:


 * Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0, 5.0
 * Microsoft Excel for Windows 95, version 7.0
 * Microsoft Excel for the Macintosh, versions 2.2, 3.0, 4.0, 5.0
 * Microsoft Excel for OS/2, versions 2.2, 2.21, 3.0

The ON.KEY macro function cannot be used to disable macro interruption with the ESC key.

To cancel or modify interruption of the macro with the ESC key, use the CANCEL.KEY function. For example, the function CANCEL.KEY(FALSE) disables the ESC key. The function CANCEL.KEY(TRUE,B1) runs the macro that starts at cell B1 when the ESC key is pressed.

NOTE: The Visual Basic, Applications Edition, equivalent for this macro function is the following:

Application.EnableCancelKey = xlDisabled