Hi Guys,
I have a problem that is gonna make me crazy:
I want to run from an Excel workbook (let's say MainWorkbook.xls)
a macro ("RunAll") placed in another workbook ("AllMacros.xls").
To do that, I wrote the following macro ("OverallRun"):
---------------------
Sub OverallRun()
'1st Argument of the macro to run;
arg1 = "Hello"
'2nd Argument of the macro to run;
arg2 = "World"
'Open the Excel file containing the macro to run;
Workbooks.Open Filename:= "E:\...\MacroExcel\AllMacros.xls"
'Run the macro;
Application.Run "'AllMacros.xls'!Modulo1.RunAll", arg1, arg2
'Close the Workbook containing the macro to run;
Workbooks("AllMacros.xls").Close SaveChanges:=False
End Sub
----------------------
The macro to run ("RunAll") is like that:
----------------------
Sub RunAll(arg1 As String, arg2 As String)
...
...
...
End Sub
----------------------
Now, the only thing I get from running "OverallRun" is this error message:
"The Macro AllMacros.xls!Modulo1.RunAll cannot be found".
I have to specify that without arguments, the macro "RunAll" start running,
so the problem should be in the arguments. However, after several attempts,
I cannot figure out what's wrong with my code.
Any suggestion? Is it possible that, since the macro "RunAll" is
not directly visible in the excel menu due to the presence of the
arguments, it cannot be accessible from outside?
Thanks to all in advance
Moderator's Note: Welcome to the forum, this is to inform you about code tags. When posting codes...select the code then hit the "#" sign to wrap it with code tags. Thank you.
Bookmarks