Application.Run
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.
You cannot use named arguments with this method. Arguments must be passed by position.
You must pass all the parameters as separate arguments and not as one single string (for example Application.Run("Macro(Arg1,Arg2,Arg3)")
If the datatype of any of your parameters (or of the returned datatype) is not declared then these items are assumed to have the Variant datatype.
All the arguments are converted to values which means you cannot pass any objects
Any objects passed as arguments to a macro will be converted to a value (by applying the Value property to the object).
Calling Procedure in a different file
This can be done in two ways.
1) Create a reference to the other file. To create a reference (Tools > References).
After a reference has been established you can call procedures in other files.
The referenced file does not have to be open and is treated like an object library.
2) Use the Application.Run method and specify the filename and folder path of the other file.
Calling Procedure assigned to a Variable
Calling Function assigned to a Variable (with Arguments)
It is possible to use Application.Run to return a value from a function.
Exactly the same thing can be achieved by using a subroutine and a ByRef argument.
If you want to call a Function that has a return value you can use the GetMemoryAddress API function.
Word
Runs a Visual Basic macro.
You can pass up to 30 parameter values to the specified macro.
If you specify the document name, your code can only run macros in documents related to the current context, not just any macro in any document.
This assumes the VBA Project has been changed to MyProject. This is rarely changed.
Include an example with a folder location as well !!
Although Visual Basic code can call a macro directly (without this method being used), this method is useful when the macro name is stored in a variable (for more information, see the example for this topic).
The following statements are functionally equivalent.
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext