Microsoft KB Archive/96380

= Microsoft Knowledge Base =

Excel: Can't Cancel ON.TIME Macro If Time Argument Uses NOW
Last reviewed: September 12, 1996

Article ID: Q96380

The information in this article applies to:


 * Microsoft Excel for the Macintosh, versions 3.0, 4.0, 4.0a, 5.0
 * Microsoft Excel for Windows, versions 3.0, 4.0, 5.0

SUMMARY
In Microsoft Excel, you can cancel an ON.TIME macro function with another ON.TIME macro function if the fourth argument (insert_logical) in the second function is set to FALSE. However, this procedure does not work if the time argument in the ON.TIME macro function is set with the the NOW function.

MORE INFORMATION
In order to cancel the first ON.TIME function, the second ON.TIME function must have the same serial number for the time argument as the first ON.TIME function. When you use a NOW function for the time argument, such as

NOW+&quot;00:04:00&quot; Microsoft Excel uses the serial value of NOW+&quot;00:04:00&quot;. When the second ON.TIME function is issued, the serial value of NOW will have changed; therefore, you cannot exactly duplicate the time argument in the second ON.TIME function.

WORKAROUND
To prepare the first ON.TIME macro function so you can cancel it later, create a defined name for the time variable and use the defined name in both cases, as in the following example:

=SET.NAME(&quot;timeset&quot;,NOW+&quot;00:04:00&quot;) =ON.TIME(timeset,&quot;testmacro&quot;) The above macro runs a macro called &quot;testmacro&quot; four minutes from the present time. To keep this macro from running, use the following syntax:

=ON.TIME(timeset,&quot;testmacro&quot;,,FALSE) This procedure works correctly because the serial value of the defined name &quot;timeset&quot; is the same as the the serial value used in the first ON.TIME statement.