Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Clear events scheduled with Ontime method

I need proc_2 to run a minute after proc_1 is finished. However, if proc_1
is run again less than a minute after the first time, I don't want it to run
until a minute after the second run:

ie proc_1 is trigered at 12:00:00, then again at 12:00:20
proc_2 runs once onl at 12:01:20

sub proc_1
'other code
application.ontime now+timevalue("00:01:00"), "proc_2")
end sub
sub proc_2
beep
application.statusbar = false
end sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Clear events scheduled with Ontime method

Try cancelling it first

Dim nTime

Sub proc_1()
On Error Resume Next
Application.OnTime nTime, "proc_2", , False
On Error GoTo 0
nTime = Now + TimeValue("00:01:00")
Application.OnTime nTime, "proc_2"
End Sub

Sub proc_2()
Beep
Application.StatusBar = False
End Sub

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Rob" wrote in message
...
I need proc_2 to run a minute after proc_1 is finished. However, if

proc_1
is run again less than a minute after the first time, I don't want it to

run
until a minute after the second run:

ie proc_1 is trigered at 12:00:00, then again at 12:00:20
proc_2 runs once onl at 12:01:20

sub proc_1
'other code
application.ontime now+timevalue("00:01:00"), "proc_2")
end sub
sub proc_2
beep
application.statusbar = false
end sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Clear events scheduled with Ontime method

Option Explicit

Dim Proc2Time As Date
Sub Proc1()
On Error Resume Next
Application.OnTime Proc2Time, "Proc2", Schedule:=False
On Error GoTo 0
Proc2Time = Now() + TimeSerial(0, 1, 0)
Application.OnTime Proc2Time, "Proc2", Schedule:=True
End Sub
Sub Proc2()
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I need proc_2 to run a minute after proc_1 is finished. However, if proc_1
is run again less than a minute after the first time, I don't want it to run
until a minute after the second run:

ie proc_1 is trigered at 12:00:00, then again at 12:00:20
proc_2 runs once onl at 12:01:20

sub proc_1
'other code
application.ontime now+timevalue("00:01:00"), "proc_2")
end sub
sub proc_2
beep
application.statusbar = false
end sub



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
Tracking OnTime Events? M. Authement Excel Programming 4 October 26th 05 03:59 PM
ontime method? max Excel Programming 8 February 8th 05 09:04 PM
ontime method? max Excel Programming 2 February 7th 05 03:25 PM
ontime Method Bill Krone Excel Programming 1 August 12th 04 04:30 PM
OnTime events bambam77[_7_] Excel Programming 7 August 9th 04 06:31 AM


All times are GMT +1. The time now is 04:38 AM.

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

About Us

"It's about Microsoft Excel"