Thread: Time Loop
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Curt D. Curt D. is offline
external usenet poster
 
Posts: 20
Default Time Loop

Thanks Leonardo, which one would I use to have it automatically run at 11:30
pm?

"Leonardo" wrote:

Hi. For a similar case, I used a code like this:

' If it's later than 23:45, Wait till next day
TiempoPausa = 0
Inicio = 0
If Timer = 85500 Then
While Timer = 85500
DoEvents
Wend
' Wait until 00:05
While Timer <= 300
DoEvents
Wend
End If
Inicio = Timer
Your_routine ' Execute your code
' Wait 15 more minutes
Minutos = 15
TiempoPausa = 60 * Minutos
Do While Timer < Inicio + TiempoPausa
DoEvents ' Other procceses
Loop

Yo can use While to loopback to your code, if neccesary.