LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Stopping Code Execution -- Newbie

Here is an abbreviated version of code that I have borrowed:

Public RunWhen As Double
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "GetData" ' 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 GetData()

<code to pull stock quotes via Web Query
StartTimer

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

Questions:
1. I have occasion to put this "on pause" while I update other aspects of
the workbook. I envision one or two buttons that halt execution, then restart
it. How might I do that?
2. What additional code would be needed to stop the queries between the
hours of, say, 4pm and 8am?

Many thanks.

 
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
stopping code Jase Excel Discussion (Misc queries) 1 October 6th 08 05:42 PM
VBA code stopping in odd places JDub Setting up and Configuration of Excel 2 October 10th 06 08:04 AM
Stopping repetitive loop execution through user form (or other ide Mike Excel Programming 8 August 18th 06 05:54 AM
Stopping Code Nigel Excel Programming 2 January 20th 06 04:39 PM
message without stopping execution? Stefi Excel Programming 19 July 14th 05 12:08 PM


All times are GMT +1. The time now is 11:53 PM.

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

About Us

"It's about Microsoft Excel"