call procedure

B

bob

my main macro starts with an input box and i want to bypass input box when
repeating macro1.
how would i goto a procedure in main macro. the following repeats 2 macros 1
every 10 min & 1 every 30 min.

if count >1 then i want to goto a procedure position in macro1 and bypass
an input box .
would the end sub in macro1 reset all parameters? i was wondering how to
keep the string value from input box in first cycle to use in repeat cycles.
is there an easier way to handle a repeat loop.

Sub refresh()
Static Counter As Integer
Static Count As Integer
Counter = Counter + 1
Count = Count + 1
' get data from web site #1
' if count is >1 goto repeat procedure in macro1 & not start of macro1

' start macro1
Windows("test.xls").Activate
Application.Run "'test.xls'!macro1"

If Counter = 3 Then
Counter = 0
' get data from web site #2
Windows("test.xls").Activate
Application.Run "'test.xls'!macro2"
End If
RunWhen = Now + TimeSerial(0, 10, 0)
Application.OnTime earliesttime:=RunWhen, _
procedure:="refresh", schedule:=True

End Sub

thanks
 
B

bob

i may be missing something here. i assume there is no problem with count as
a local variable in macro refresh that runs macro1 . my problem is the input
string ABC from the input box of macro1 gets reset by completing macro1 so
when i want to bypass the input box when running macro1 a 2nd time from
refresh sub i need a way to store input box string for future use


Sub macro1() 'get data
' If A <>" " Then GoTo Repeat procedure .. 'bybass input box

Symbol = InputBox("Enter a stock ", "Stock Symbol")
If Symbol = "" Then Exit Sub

A = Symbol
Repeat:
'refresh entry point when looping

Application.ScreenUpdating = False
connectURL = "URL;http://quote.cboe.com/QuoteTable.dat"

end sub

what statement would i use in refresh macro to goto Repeat procedure in
macro1and what code would i use to save the value from input box as a
global variable if that is how to keep it for future reference. i have a sub
to stop refresh macro and i was wondering if i would need a statement in
there that would clear ABC if it is stored as a global variable

Sub refresh()
Static Counter As Integer
Static Count As Integer
Counter = Counter + 1
Count = Count + 1
' get data from web site #1
' if count is >1 goto repeat procedure in macro1 & not start of macro1

' run macro1
Windows("test.xls").Activate
Application.Run "'test.xls'!macro1"


thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top