Microsoft KB Archive/75179

{| = DISABLE.INPUT Disables ON.KEY Command in Excel =
 * width="100%"|

Last reviewed: November 2, 1994

Article ID: Q75179

SUMMARY
The DISABLE.INPUT macro command functions differently in Microsoft Excel 3.0 for Windows than it does in Excel versions 2.x. The difference occurs when the ON.KEY command is executed following the DISABLE.INPUT command.

MORE INFORMATION
The DISABLE.INPUT blocks all input from the keyboard and mouse to Excel. The ON.KEY command runs a specified macro when a particular key or key combination is pressed. If a DISABLE.INPUT(TRUE) command is followed by an ON.KEY command in Excel 2.x, the ON.KEY command functions properly. In Excel 3.0, the ON.KEY command is ignored.

Example
  Enter the following data into a macro sheet: A1: Main_Macro A2: =ERROR(0) A3: =ECHO(1) A4: =DISABLE.INPUT(1) A5: =ON.KEY(&quot;{RIGHT}&quot;,&quot;Macro1.xlm!Test&quot;) A6: =RETURN A7: A8: Test A9: =DISABLE.INPUT(0) A10: =RETURN  In Excel 2.x, run Main_Macro. You will now be unable to type anything at the keyboard or select anything with your mouse.  Press the RIGHT ARROW key. Note that pressing the RIGHT ARROW key returns control of the keyboard and mouse.  Follow steps 2 and 3 in Excel 3.0.

Note that you are not given back control of the keyboard and mouse.