ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How Do I Use an XLL Add-In Function from Code? (https://www.excelbanter.com/excel-programming/365146-how-do-i-use-xll-add-function-code.html)

TC[_9_]

How Do I Use an XLL Add-In Function from Code?
 
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


TC[_9_]

How Do I Use an XLL Add-In Function from Code?
 
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




All times are GMT +1. The time now is 01:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com