View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Xing Zhou Xing Zhou is offline
external usenet poster
 
Posts: 2
Default Excel VBA - Timer

I have a VBA function in an Excel spreadsheet that is called on a
timer as follows:



Function f()

scheduleNextCallToF

' CATCH ANY ERRORS
On Error GoTo SomethingHappened:

' DO SOME WORK

SomethingHappened:
MsgBox "We've had a problem publishing the curves :
write this down - " & Err.Number & " " & Err.Description & "
" & Err.Source


End Function

Function scheduleNextCallToF()

Private runWhen As Double

runWhen = Now + TimeSerial ( 0 , 0 , 30) 'RUNS EVERY 30 SECS

Application.OnTime earliesttime:=runWhen , prodedu= "f" , schedule
:=False

End Function


This function runs fine for the majority of the day, however each
morning for _some_ users, the function stops working.
However no error appears to take place as the MsgBox never appears.

[Note: The DO SOME WORK section takes less than a second to be
performed]