I need to call a method that is provided by a third-party XLA add-in via my VBA code.
There are already answers for doing this with a loaded XLL add-in, but the intention is to call the method directly.
I need to call a method that is provided by a third-party XLA add-in via my VBA code.
There are already answers for doing this with a loaded XLL add-in, but the intention is to call the method directly.
Based on e.James' answer for calling an XLL add-in, I figured out the right format to use if the Add-in isn't already loaded. You can use
Application.Run
for calling methods inside an .xla Add-in the following way:If we assume that the path to our .xla file is
C:\Program Files\example.xla
and the method we want to call isExampleMethod
expecting one integer parameter, then the call would be as follows:So you will need to construct a string of the form
for the call and then just append all needed parameters like
Unfortunately, I found that CuberChase's answer that declares the method directly like an API call doesn't work with my specific .xla file, maybe it would have needed to be loaded to work.