Excel/Visual Basic

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
 
J

JE McGimpsey

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top