Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default application.ontime

I have a simple routine that schedules several subroutines to run durin the
day.
Sub aaatest99()
Application.OnTime TimeValue("07:59:50"), "aaaget800val"
Application.OnTime TimeValue("08:59:50"), "aaaget900val"
Application.OnTime TimeValue("09:59:50"), "aaaget1000val"
end sub

If I open excel, and run this routine. Then close excel, and re-open excel
and re-run this routine... it appears that the subroutines are scheduled to
run again, at the specified times. So that they will run twice, ie. the
sceduled running of the subroutine was not cancelled when I closed excel.

How exactly does Application.OnTime work?
thanks, Rick

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default application.ontime

when you close excel, the scheduled activities are cancelled to the best of
my knowledge. Perhaps your code is recursive.

--
Regards,
Tom Ogilvy

"rick" wrote in message
...
I have a simple routine that schedules several subroutines to run durin

the
day.
Sub aaatest99()
Application.OnTime TimeValue("07:59:50"), "aaaget800val"
Application.OnTime TimeValue("08:59:50"), "aaaget900val"
Application.OnTime TimeValue("09:59:50"), "aaaget1000val"
end sub

If I open excel, and run this routine. Then close excel, and re-open

excel
and re-run this routine... it appears that the subroutines are scheduled

to
run again, at the specified times. So that they will run twice, ie. the
sceduled running of the subroutine was not cancelled when I closed excel.

How exactly does Application.OnTime work?
thanks, Rick



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default application.ontime

Rick,

Cancel prior to scheduling:

Sub aaatest99()
On Error Resume NExt
Application.OnTime TimeValue("07:59:50"), "aaaget800val", schedule:=False
Application.OnTime TimeValue("08:59:50"), "aaaget900val", schedule:=False
Application.OnTime TimeValue("09:59:50"), "aaaget1000val", schedule:=False
Application.OnTime TimeValue("07:59:50"), "aaaget800val"
Application.OnTime TimeValue("08:59:50"), "aaaget900val"
Application.OnTime TimeValue("09:59:50"), "aaaget1000val"
end sub

HTH,
Bernie
MS Excel MVP


"rick" wrote in message
...
I have a simple routine that schedules several subroutines to run durin the
day.
Sub aaatest99()
Application.OnTime TimeValue("07:59:50"), "aaaget800val"
Application.OnTime TimeValue("08:59:50"), "aaaget900val"
Application.OnTime TimeValue("09:59:50"), "aaaget1000val"
end sub

If I open excel, and run this routine. Then close excel, and re-open excel
and re-run this routine... it appears that the subroutines are scheduled to
run again, at the specified times. So that they will run twice, ie. the
sceduled running of the subroutine was not cancelled when I closed excel.

How exactly does Application.OnTime work?
thanks, Rick



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.ontime from shared drive jlclyde Excel Discussion (Misc queries) 3 August 20th 09 09:42 PM
OnTime Unusual Application Peter[_52_] Excel Programming 4 January 19th 05 05:59 AM
Application.OnTime driving me crazy Lars-Åke Aspelin Excel Programming 0 October 31st 04 12:24 AM
Application.OnTIme Mike Excel Programming 8 September 15th 04 03:27 PM
Application.OnTime and Visual C++ cdupain Excel Programming 0 November 12th 03 10:11 AM


All times are GMT +1. The time now is 11:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"