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 use this to update weather information and the current
company stock price 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.
 
M

Myrna Larson

Probably because the time gets reset to 0 at midnight. Are you using an OnTime
macro for this? If not, you could try it. With that approach, the last line of
the macro typically sets up the next run, at a specific time. That time can
include a date. That would take care of the midnight problem.
 
G

Guest

I'm not sure if I fully understand your reply. I'm not actually using a
fixed or set time - I am having it loop back to the beginning after a set
number of seconds. I was thinking more along the lines of using an "error"
or "onerror" function to call another macro in (the event of an error) that
would restart the original macro. I know you can do this in Access but I'm
not sure how or if this will work in Excel. Can you elaborate on this?

Thanks

MikeS
 
M

Myrna Larson

Can you post the code? Have you used a Timer control? I am suggestion that you
use an OnTime macro. Check it out in Help. Basically, you set a fixed time for
the macro to run. When that happens, the last line in the macro "schedules"
the next run, based on the current date and time plus the required number of
seconds.
 

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