Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run macro ever 5 seconds and turn off?
Hi everyone!
I was hoping to get some feedback on how to get a macro to run every 5 seconds and turn it's self off when it's done doing what it has to? What I am trying to do is get a webbrowser object to refresh it's self every 5 seconds...but I need it so that someone can still use the userform I created instead of causing Excel to lockup ever 5 seconds... I tried the following code... Private Sub UserForm_Activate() Do Until Now = Now + TimeValue("00:00:05") WebBrowser1.Navigate ("C:\www.Cnn.com") Loop End Sub Any ideas would be greatly appreciated. Thank you! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run macro ever 5 seconds and turn off?
The code
Do Until Now = Now + TimeValue("00:00:05") will never be true. Every time that line of code runs, Now gets a new value and Now will never be equal to Now + 5 seconds. See www.cpearson.com/Excel/OnTime.htm for details about using the OnTime method. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting www.cpearson.com (email on the web site) wrote in message oups.com... Hi everyone! I was hoping to get some feedback on how to get a macro to run every 5 seconds and turn it's self off when it's done doing what it has to? What I am trying to do is get a webbrowser object to refresh it's self every 5 seconds...but I need it so that someone can still use the userform I created instead of causing Excel to lockup ever 5 seconds... I tried the following code... Private Sub UserForm_Activate() Do Until Now = Now + TimeValue("00:00:05") WebBrowser1.Navigate ("C:\www.Cnn.com") Loop End Sub Any ideas would be greatly appreciated. Thank you! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I change a minutes and seconds as a 2400 time to seconds? | Excel Worksheet Functions | |||
Macro wait 30 seconds then Complete the Macro | Excel Discussion (Misc queries) | |||
Formula to Change Hours:Minutes:Seconds to Seconds only | Excel Discussion (Misc queries) | |||
Converting Julian Seconds with a macro to replace old seconds data | Excel Discussion (Misc queries) | |||
Convert "Time Interval" in "hours : minutes : seconds" to seconds | New Users to Excel |