Thread: On time Event
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default On time Event

You need to set RunWhen and then call OnTime from within The_Sub.


"ExcelMonkey " wrote
in message ...
So Chip, I used teh following code from your site. But it only

ran once
as opposed to every minute.

Public RunWhen As Double
Public Const cRunIntervalSeconds = 60 ' one minute
Public Const cRunWhat = "The_Sub"

Sub StartTimer()

RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat,

_
schedule:=True
End Sub

Sub The_Sub()
MsgBox "Wake up. Its time for your afternoon break!"
End Sub


---
Message posted from http://www.ExcelForum.com/