Excel/Visual Basic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the timer function in a macro to re-run a web query after a set
amount of time. I am using this to continuously update the current weather
and company stock prices for a "Video Bulletin Board. The problem is, the
macro aborts every night at 11:59. Can anyone tell me why this is happening
and how to fix it?

Thanks in advance.

Mike
 
Without seeing your code, it's hard to tell, but I suspect the reason is
that you're using a comparision, e.g.:

If Time > oldTime + TimeSerial(0, 1, 0) Then ...

Since Time is actually a value based on fractional days (e.g., 0:00 = 0,
12:00 = 0.5, 11:59 PM = 0.999305555555556), the comparison will fail at
midnight.

You might consider using an OnTime macro, instead:

http://cpearson.com/excel/ontime.htm
 
Back
Top