Autosave worksheet at a predetermined time

Application.OnTime

Code Templates

Application.OnTime

Application.OnTime (EarliestTime, Procedure [,LatestTime] [,Schedule])

EarliestTime (variant):

The predetermined time you want to execute the application

  • Now
  • Now + TimeValue(“00:00:15”)

Procedure (string):

The applicaton you want to execute

Latesttime (variant):

The latest time at which the procedure can be run. If you do not specify a ‘LatestTime’ then the macro will run when Excel is available after the ‘EarliestTime’ has passed. For example, if LatestTime is set to EarliestTime + 30 and Microsoft Excel is not in Ready, Copy, Cut, or Find mode at EarliestTime because another procedure is running, Microsoft Excel will wait 30 seconds for the first procedure to complete. If Microsoft Excel is not in Ready mode within 30 seconds, the procedure won’t be run. If this argument is omitted, Microsoft Excel will wait until the procedure can be run.

Schedule (variant):

True to schedule a new OnTime procedure. False to clear a previously set procedure.

--

--