Application.Run Method (Excel)

Runs a macro or calls a function. This can be used to run a macro written in Visual Basic or the Microsoft Excel macro language, or to run a function in a DLL or XLL.

Syntax

expression. Run( _Macro_ , _Arg1_ , _Arg2_ , _Arg3_ , _Arg4_ , _Arg5_ , _Arg6_ , _Arg7_ , _Arg8_ , _Arg9_ , _Arg10_ , _Arg11_ , _Arg12_ , _Arg13_ , _Arg14_ , _Arg15_ , _Arg16_ , _Arg17_ , _Arg18_ , _Arg19_ , _Arg20_ , _Arg21_ , _Arg22_ , _Arg23_ , _Arg24_ , _Arg25_ , _Arg26_ , _Arg27_ , _Arg28_ , _Arg29_ , _Arg30_ )

expression A variable that represents an [Application](Excel.Application(Graph property).md) object.

Parameters

Name Required/Optional Data Type Description
Macro Optional Variant The macro to run. This can be either a string with the macro name, a Range object indicating where the function is, or a register ID for a registered DLL (XLL) function. If a string is used, the string will be evaluated in the context of the active sheet.
Arg1-Arg30 Optional Variant An argument that should be passed to the function.

Return Value

Variant

Remarks

You cannot use named arguments with this method. Arguments must be passed by position.

The Run method returns whatever the called macro returns.

See also

Application Object