Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bob bob is offline
external usenet poster
 
Posts: 16
Default call procedure

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


  #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






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
call procedure problem stan Excel Discussion (Misc queries) 2 August 17th 09 06:11 PM
to call procedure in a worksheet in a module CAPTGNVR Excel Discussion (Misc queries) 4 January 30th 07 09:39 PM
Run-time error '5': Invalid Procedure Call or Argument Nikila Excel Discussion (Misc queries) 2 February 24th 06 09:26 PM
procedure won't call John Gittins Excel Programming 0 August 5th 03 08:17 PM
Run-time error '5':Invalid Procedure call or argument Jan Refsdal Excel Programming 1 July 25th 03 05:14 AM


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