I've done some research, and I can answer my own question. For anyone
who stumbles across this post, hoping for an answer, here it is:
1. I was using the wrong syntax. To use an XLL function, first register
the XLL with Application.RegisterXLL(), then run the function with
Application.Run().
-TC
TC wrote:
My question, short form:
I have an Excel Add-In, packaged as an XLL, which contains a worksheet
function -- let's call it F(). Can I use F() from VB/VBA? If so, how?
My question, long form:
I'm writing VB code for a client. My code needs to use a proprietary
modeling function developed by the client. I expected the client to
deliver their function to me in the form of a DLL. Instead, they sent
me an XLL. If I load the XLL into Excel as an add-in, I can call the
function from a worksheet. I cannot, however, call it from code. I've
tried adding a reference to the XLL file, but I cannot. The XLL, by the
way, requires a license for registration.
I believe one of the following is true, but I'm not sure which. Can
anyone offer suggestions?
1. I'm using the wrong syntax or the wrong approach. If I reference it
correctly, I should be able to access the XLL function from VB/VBA.
2. XLL functions can be referenced from code, but only if the
programmer configures them to be. In order to use the function, I need
to ask the client to modify his XLL, exposing the function to my code.
3. XLL functions cannot be referenced from code. I must ask the client
to repackage the function as a DLL.
-TC