"Mark" <anon...@discussions.microsoft.com> wrote in message
news:015e01c3bd0a$66854b00$a401...@phx.gbl...
> The only way to make it work
> is to use the Application.Run command. But you can not
> pass arguements using that approach.
Application.Run "MYCUSTOM.XLM!My_Func_Sum", 1, 5
Syntax 1 and Syntax 2 assume that the macros are either in the same
WorkBook or that there is a Reference to the WorkBook containing the
macros.
To set a reference to another WorkBook : If the WorkBook containing
the macro to run is not open, open the WorkBook. Alt-F11 to access
VBE. Ctrl-R to activate Project Explorer. Select the project of the
macro that does the calling. Tools > References. Check the name of the
project that contains the called macros.
Syntax 1
Call MacroName ' No parameters
Call MacroName (param1, param2) ' Parameters
Syntax 2
MacroName ' No parameters
MacroName param1, param2 ' Parameters
Syntax 3 assumes that the WorkBook contaning the called macros is
open, but that there are no References to that WorkBook.
Application.Run "'FileName.xls'!MacroName"
' No parameters
Application.Run "'FileName.xls'!MacroName", param1, param2
' Parameters
Syntax 4 assumes that the WorkBook contaning the called macros is not
open.
Application.Run "'" & "PathName" & "FileName.xls" & "'!MacroName"
' No parameters
Application.Run "'" & "PathName" & "FileName.xls" & "'!MacroName",
param1, param2
' Parameters
HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------