Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change a minutes and seconds as a 2400 time to seconds? NickBrown419 Excel Worksheet Functions 1 August 10th 08 09:12 PM
Macro wait 30 seconds then Complete the Macro Vick Excel Discussion (Misc queries) 2 June 2nd 08 08:04 PM
Formula to Change Hours:Minutes:Seconds to Seconds only Cheri Excel Discussion (Misc queries) 4 August 30th 06 12:44 AM
Converting Julian Seconds with a macro to replace old seconds data Keldair Excel Discussion (Misc queries) 2 February 18th 06 12:09 AM
Convert "Time Interval" in "hours : minutes : seconds" to seconds Ianukotnorth New Users to Excel 7 May 8th 05 08:11 PM


All times are GMT +1. The time now is 09:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"