Microsoft KB Archive/62290

= Halting Macro for User Input in Excel =

Article ID: 62290

Article Last Modified on 11/16/2006

-

APPLIES TO


 * Microsoft Excel 95 Standard Edition
 * Microsoft Excel 5.0c
 * Microsoft Excel 5.0 Standard Edition
 * Microsoft Excel 2.1 Standard Edition
 * Microsoft Excel 2.0 Standard Edition

-



This article was previously published under Q62290



SUMMARY
Lotus 1-2-3 allows the use of the &quot;?&quot; (the question mark [without quotation marks]) to temporarily suspend macro execution while waiting for your input. Microsoft Excel, however, does not allow halting the macro to wait for your input without using an INPUT or similar command.

To mimic the &quot;?&quot; in a Lotus macro, the following macro segment can be used to halt a macro to wait for your input, without using an INPUT or related function:

  On.time sub-macro to halt macro and wait for user input

=ON.TIME(NOW+0.0000000001,&quot;(reference to resume calling macro)&quot;) =SEND.KEYS(&quot;{f2}&quot;) =RESTART =RETURN

The RESTART function tells the macro not to return to the calling macro. This method is used because the ON.TIME function is used to restart the macro in a specified amount of time.

This same method can be used to bring up a dialog box for which Excel does not provide a macro command, such as the Formula Notes dialog box. A modification to the SEND.KEYS function to bring up the desired dialog box is all that is needed.

  =ON.TIME(NOW+0.0000000001,&quot;(reference to resume calling macro)&quot;) =SEND.KEYS(&quot;(%r)n&quot;) =RESTART =RETURN

NOTE: the information above also applies to version 5.0 and later only when using version 4.0 macro language.

Additional query words: 2.0 2.01 2.1 2.2 2.20 2.21 3.0 3.00 4.0 4.00 4.0a 4.00a 5.0 pause pausing

Keywords: KB62290

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.