![]() |
CORRECT SYNTAX FOR RUN...
Hi,
I've been trying to solve this problem for a few days now. What is the correct syntax for Run, when executing a sub procedure in a DIFFERENT workbook under the following conditions: the procedure has arguments, and you are passing the code to run the macro with its arguments as 1 string: sub RunMacro(STRING) Application. Run STRING End Sub Where STRING has a value like "FILE.XLS!MACRO ARG1, ARG2" Thanks for any help you can give Regards, Ian |
CORRECT SYNTAX FOR RUN...
Try this
"FILE.XLS!MACRO", "ARG1", "ARG2" -- Regards Ron de Bruin http://www.rondebruin.nl wrote in message oups.com... Hi, I've been trying to solve this problem for a few days now. What is the correct syntax for Run, when executing a sub procedure in a DIFFERENT workbook under the following conditions: the procedure has arguments, and you are passing the code to run the macro with its arguments as 1 string: sub RunMacro(STRING) Application. Run STRING End Sub Where STRING has a value like "FILE.XLS!MACRO ARG1, ARG2" Thanks for any help you can give Regards, Ian |
CORRECT SYNTAX FOR RUN...
You cannot do it in a single string, you need
sub RunMacro(STRING, arg1, arg2) Application. Run STRING,arg1,arg2 End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) wrote in message oups.com... Hi, I've been trying to solve this problem for a few days now. What is the correct syntax for Run, when executing a sub procedure in a DIFFERENT workbook under the following conditions: the procedure has arguments, and you are passing the code to run the macro with its arguments as 1 string: sub RunMacro(STRING) Application. Run STRING End Sub Where STRING has a value like "FILE.XLS!MACRO ARG1, ARG2" Thanks for any help you can give Regards, Ian |
CORRECT SYNTAX FOR RUN...
Hi,
Thanks everyone for your help. I think Bob Phillips may be right. if the macro to run were in the same file as the macro calling it, the following would work: STRING = "'MACRO_WITHOUT_FILEPATH, "ARGUMENT 1", ETC '" Run STRING if the macro to run were in another file but had no arguments the following works: STRING = "FILE.xls!MACRO" Run STRING But no variations of these seem to work for the case of a macro taking arguments, and located in another file Thanks again. Ian |
All times are GMT +1. The time now is 12:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com