Microsoft KB Archive/45474

From BetaArchive Wiki

Time Considerations in Excel Macros with ON.TIME() And WAIT()

The information in this article applies to:

  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0


In Microsoft Excel, when you use the ON.TIME and WAIT macro functions, it is important to remember that there is no guarantee that the macro specified will run at exactly the time indicated.

Microsoft Excel guarantees only that the macro will run if it is at least the time indicated or the specified amount of time has elapsed since the ON.TIME or WAIT statement was executed.


To understand why Microsoft Excel, or any Microsoft Windows application, cannot guarantee an action to occur at a specific time, it is necessary to look at the Microsoft Windows operating environment.

Microsoft Windows functions as a messaging system, with each application receiving the processor for a period of time to handle any messages that are in its message queue.

If you use ON.TIME to execute the macro TEST.XLM at noon, Microsoft Excel will not run it before noon, but it is possible that Microsoft Excel may not run TEST.XLM until 12:05.

This delay occurs because Microsoft Excel may not have the processor at noon; another application may be processing messages in its message queue and may not release the processor until it is finished. When the other application releases the processor and Microsoft Excel gains control, it will process messages in its queue, including the one that tells it to run TEST.XLM.

Additional query words:

Keywords :
Version :
Platform :
Issue type :
Technology :

Last Reviewed: March 15, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.