Application Caller

Add-in Express™ Support Service
That's what is more important than anything else

Only registered users are allowed to subscribe.
Application Caller
Get full Path of caller excel file  
Andrei Smolin


Add-in Express team


Posts: 15280
Joined: 2006-05-11
Hello Michael,

You use XLL to create a worksheet function. A worksheet function is a function that 1) calculates a value and 2) returns it; note that it doesn't change anything in Excel data. Further on, Excel deals with accepting the result, performing further calculations, and displaying the resulting value (or error). A worksheet function is used as follows: =YourFunction()+1.

This definition (it's mine; you can probably find a better one) doesn't let your function change anything on the worksheet; you use a COM add-in to change a cell on a worksheet. On the other hand, it lets your function read any data required.

The page you referenced is a great source of info. If I cut out all the marketing bla-bla-bla from section Writing High-Performance User-Defined Worksheet Functions on that page and translate what remains to a not-so-plain English, I get this:

Excel C API is used in XLLs. This is a fast way to read Excel data. This way is difficult because some Excel functionality available in VBA, COM or .NET doesn't have equivalents in C API.


C API means "styled to be used in C"; it doesn't *support* anything from VBA, COM or .NET; it may only provide equivalents.

I think an asynchronous UDF is unable to read a cell.

Michael Kaden writes:
The fact that I get no error or other problem in using these Objects in my XLL AddIN, supports my guess.


You use these objects in an XLL by taking them from the Excel object model; this doesn't mean XLL supports them. I explained earlier that calling into the Excel object model from an XLL may cause an issue; I base this idea on the page which is now deleted; it's address was http://support.microsoft.com/kb/301443. That you don't get errors or problems may mean you haven't run in a scenario where the issue shows itself. Or, this may mean there's no crime in doing this.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Jan, 2018 09:40:29 Top
Michael Kaden




Posts: 163
Joined: 2017-11-15
Dear Andrei,

thank you.

Ok I should further detail it. I use the Workbook, Worksheet, Range Object in XLL only to read cells not to write to them or manipulate them in any way. I am aware that while a cell function (UDF) is executed one cannot write or manipulate other cells as it can only write back to (address) the calling cell. But for me it looks like that reading values from other cells works perfect. This is all what I do. Your

On the other hand, it lets your function read any data required.


reads to me that what I am doing (use Excel Objects to collect cell values fro the UDF calculation) is ok.


thank you & kind regards

Michael
Posted 19 Jan, 2018 10:11:37 Top
Andrei Smolin


Add-in Express team


Posts: 15280
Joined: 2006-05-11
Hello Michael,

I don't know if this can be confirmed/disproved.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Jan, 2018 05:12:15 Top
Michael Kaden




Posts: 163
Joined: 2017-11-15
Dear Andrei,

do you know an Excel Object, when it is called from XLL will raise an error?

Strange, that nobody in the www seems to have found a list of which Excel Object uses are supported by XLL and which not. I have a feeling it is somehow connected to the C API functions:

C API Excel4/Excel12

Just a thought.

Otherwise we leave it as is and I will post when I find some more information or when I get problems with using the basic Objects as described above.

Thank you & regards

Michael
Posted 22 Jan, 2018 06:11:30 Top
Andrei Smolin


Add-in Express team


Posts: 15280
Joined: 2006-05-11
Michael,

XLL doesn't support any object from the Excel object model. As to what objects from the Excel model object you can (or cannot) call from an XLL, I don't know an answer to this question.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Jan, 2018 06:28:37 Top