ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run macro in another workbook with arguments (https://www.excelbanter.com/excel-programming/292157-run-macro-another-workbook-arguments.html)

Jos Vens

Run macro in another workbook with arguments
 
Hi,

is it possible to run a macro in another workbook which receives arguments?
Let's say I have two workbooks open: The calling wb is WB.xls and the
procedure I want to run is in the workbook AnotherWB.xls. Without
arguments, everything works fine but if that MyProcedure is

'Procedure is part of AnotherWB.xls

Sub MyProcedure (vArg as integer)

for i=1 to vArg
msgbox (i)
next

end sub

I am not able to do this in worbook WB.xls

Run "'AnotherWB.xls'!MyProcedure, 5"

Am I doing something wrong???

Thanks
Jos Vens



Tom Ogilvy

Run macro in another workbook with arguments
 
Run "AnotherWB.xls!MyProcedure", 5

Regards,
Tom Ogilvy


"Jos Vens" wrote in message
...
Hi,

is it possible to run a macro in another workbook which receives

arguments?
Let's say I have two workbooks open: The calling wb is WB.xls and the
procedure I want to run is in the workbook AnotherWB.xls. Without
arguments, everything works fine but if that MyProcedure is

'Procedure is part of AnotherWB.xls

Sub MyProcedure (vArg as integer)

for i=1 to vArg
msgbox (i)
next

end sub

I am not able to do this in worbook WB.xls

Run "'AnotherWB.xls'!MyProcedure, 5"

Am I doing something wrong???

Thanks
Jos Vens





Jos Vens

Run macro in another workbook with arguments
 
Thanks Tom!

Jos

"Tom Ogilvy" schreef in bericht
...
Run "AnotherWB.xls!MyProcedure", 5

Regards,
Tom Ogilvy


"Jos Vens" wrote in message
...
Hi,

is it possible to run a macro in another workbook which receives

arguments?
Let's say I have two workbooks open: The calling wb is WB.xls and the
procedure I want to run is in the workbook AnotherWB.xls. Without
arguments, everything works fine but if that MyProcedure is

'Procedure is part of AnotherWB.xls

Sub MyProcedure (vArg as integer)

for i=1 to vArg
msgbox (i)
next

end sub

I am not able to do this in worbook WB.xls

Run "'AnotherWB.xls'!MyProcedure, 5"

Am I doing something wrong???

Thanks
Jos Vens








All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com