View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Is there an alternative to Application.Run

OK, I am sure it can work.
Try to make it a function with return values.
You could make it return an array holding the 2 values.

RBS

"John Pritchard" wrote in message
...
Thanks for the reply BUT the problem is Arg1 and Arg2 are passed by value
i.e. I can't see the changes that the called routine made to them.

"RB Smissaert" wrote:

Try it like this:

Application.Run "Workbook1.xls!Module1.Procedure1", Arg1, Arg2

RBS

"John Pritchard" wrote in
message
...
I'd like to call sub routines that reside in another workbook. I know
about
application.run but if I want to pass arguments byref it doesn't seem
to
work
(i.e. the changed value is not passed back). In the Vb help on calling
procedures with the same name there's this example:-
Sub Main()
[MyProject.vbp].[MyModule].Main
End Sub

I've tried renaming projects and using this:-
Sub Main()
[MyProject.xls].[MyModule].Hello
End Sub

..but can't make it see my hello procedure.
Where am I going wrong and once right will it allow me to do things
like
this:-

Sub Main()
a = 1
b = 2
[MyProject.xls].[MyModule].Swap(a,b)
msgbox ("Swapped " & a & "," & b)
End Sub

Any help much appreciated! J.P.