#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Timed Event

I wish to run one web query every, say, three minutes or so, and another web
query daily. I now wish to add additional coding related to the daily query
that extracts info from the query and places it in a table.

Right now, I use Connections Properties to refresh every X minutes for both
queries, but things will get more complicated due to the table coding.

Here is the code I've often seen to control timed events.

Public RunWhen As Double
Public PauseStuff As Boolean
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "GetData3" ' the name of the procedure to run
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat,
Schedule:=True
End Sub

Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat,
Schedule:=False
End Sub

My questions a
1. Should I continue to use the Connections Properties settings to govern
the refresh rates, or should I programmatically refresh within my GetData3
subroutine?
2. I could treat both queries the same, both refreshing every 3 minutes, but
this seems inefficient. Should I concern myself with this? If so, how do I
refresh one query every three minutes, and the other every 24 hours?
3. How, if at all, can I programmatically pause, then restart all this
refreshing? I have tried a button linked to the StopTimer subroutine, but it
didn't seem to work, and I had no visual clue about the current state (start
vs stop).
4. I've read about and experienced the above code resurrecting itself after
closing the workbook, opening up the closed workbook to run. I assume I need
a workbook BeforeClose routine to call StopTimer. Please advise.

Obviously, I need help. Many thanks.
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
Timed Message Box FARAZ QURESHI Excel Discussion (Misc queries) 3 January 26th 07 03:13 PM
Timed Message Box mercedes[_3_] Excel Programming 2 July 12th 05 01:48 AM
Setting a timed event in Excel - Please Help Bob Phillips[_6_] Excel Programming 0 April 30th 04 07:07 PM
Setting a timed event in Excel - Please Help Bob Phillips[_6_] Excel Programming 0 April 30th 04 07:06 PM
How to set Timed event to recur. Random Excel Programming 2 August 30th 03 10:31 PM


All times are GMT +1. The time now is 02:05 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"