It is possible to use Application.Run to return a value from a function.Įxactly the same thing can be achieved by using a subroutine and a ByRef argument. Calling Procedure assigned to a Variable Calling Function assigned to a Variable (with Arguments) The referenced file does not have to be open and is treated like an object library.Ģ) Use the Application.Run method and specify the filename and folder path of the other file. To create a reference (Tools > References).Īfter a reference has been established you can call procedures in other files. Calling Procedure in a different fileġ) Create a reference to the other file. If the datatype of any of your paramaters (or of the returned datatype) is not declared then these items are assumed to have the Variant datatype.Īll the arguments are converted to values which means you cannot pass any objectsĪny objects passed as arguments to a macro will be converted to a value (by applying the Value property to the object). You must pass all the parameters as separate arguments and not as one single string (for example Application.Run("Macro(Arg1,Arg2,Arg3)") You cannot use named arguments with this method. 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.
0 Comments
Leave a Reply. |