ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CORRECT SYNTAX FOR RUN... (https://www.excelbanter.com/excel-programming/370824-correct-syntax-run.html)

[email protected]

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


Simon Lloyd[_890_]

CORRECT SYNTAX FOR RUN...
 

Ian, i'm not entirely sure what it is your trying to do if all you wan
to do is run a macro you just call it like Call RunMacro. I created
macro called Test1 and put this line in the Worksheet SelectionChang
event (just cos i'm lazy) Application.Run ("Test1"), so when i selecte
a new cell it run the macro.....it worked fine.

Regards,
Simo

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=57321


Simon Lloyd[_891_]

CORRECT SYNTAX FOR RUN...
 

Perhaps something like this?

Application.Workbooks.Open ("C:\Documents an
Settings\Simon\Desktop\test.xls")
With Workbooks("test.xls")
Application.Run ("Macro1")
End Wit

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=57321



All times are GMT +1. The time now is 12:23 PM.

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