Thread: call procedure
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
bob bob is offline
external usenet poster
 
Posts: 16
Default call procedure

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

Bob Phillips wrote in message
...
Bob,

By being a local variable, Count will be cleared on exit. Make it module
wide by declaring it outside of the sub, and it will still be available

and
loaded next time around.

--

HTH

Bob Phillips

"bob" wrote in message
. ca...
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, _
procedu="refresh", schedule:=True

End Sub

thanks