[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Run a macro continuously

vernalGreens

12/14/2006 1:41:00 PM

My macro fetches data from a website. I want this macro to get the data
every 30 seconds.

So I've inserted a time delay. Here's the code.

Start = Timer ' Set start time.
Do While Timer < Start + 30
DoEvents ' Yield to other processes.
Loop


After going through this piece of code, I want to get new data from the
website. So the macro should run automatically after every 30 seconds.
How can I achieve this?

2 Answers

Mike Woodhouse

12/14/2006 4:02:00 PM

0



On Dec 14, 1:40 pm, vernalGre...@gmail.com wrote:
> My macro fetches data from a website. I want this macro to get the data
> every 30 seconds.
>
> So I've inserted a time delay. Here's the code.
>
> Start = Timer ' Set start time.
> Do While Timer < Start + 30
> DoEvents ' Yield to other processes.
> Loop
>
> After going through this piece of code, I want to get new data from the
> website. So the macro should run automatically after every 30 seconds.
> How can I achieve this?

You might want to take a look at Application.OnTime (just search the
VBA help for "OnTime").

Mike

vernalGreens

12/15/2006 7:16:00 AM

0

application.ontime helped.
Thanks

Mike Woodhouse wrote:
> On Dec 14, 1:40 pm, vernalGre...@gmail.com wrote:
> > My macro fetches data from a website. I want this macro to get the data
> > every 30 seconds.
> >
> > So I've inserted a time delay. Here's the code.
> >
> > Start = Timer ' Set start time.
> > Do While Timer < Start + 30
> > DoEvents ' Yield to other processes.
> > Loop
> >
> > After going through this piece of code, I want to get new data from the
> > website. So the macro should run automatically after every 30 seconds.
> > How can I achieve this?
>
> You might want to take a look at Application.OnTime (just search the
> VBA help for "OnTime").
>
> Mike