PDA

View Full Version : Solved: Timer Delay



Kindly_Kaela
02-02-2007, 12:35 PM
Hi,

I'm looking for code to run a delayed timer. I want a 5 minute delay before Excel grabs data from SQL, updates some charts, and continues this process every 5 minutes.

Please advise.

Thanks,
Kaela

:cloud9:

Kindly_Kaela
02-02-2007, 01:03 PM
Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)


Sub Start()
Sleep (30000)
MsgBox ("I love men with harps")
End Sub

Bob Phillips
02-02-2007, 02:21 PM
Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)

Wait is better


Application.Wait Now() + 300



Sub Start()
Sleep (30000)
MsgBox ("I love men with harps")
End Sub

So you love the Captain?

mdmackillop
02-02-2007, 02:32 PM
Another way
Dim Starts As Date
Sub Times()
Starts = Now
Application.OnTime Starts + TimeValue("00:00:05"), "DoBeep"
End Sub

Sub DoBeep()
Beep
Times
End Sub