Get range of caller using the xll udfs

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

Get range of caller using the xll udfs
How to get the range of caller using the xll udf 
Ashim Mishra




Posts: 43
Joined: 2016-03-01
Hi Team,

We are planning to port our automation addin udf to xll based UDF. We stumbled on one part where we are accessing the range of the callee cell. Based on the documentation and other blogs i believe we can access the caller object like


var callingRange = Module.CallWorksheetFunction(ADXExcelWorksheetFunction.Caller) as ADXExcelRef;
var index = callingRange.ConvertToA1Style();
// this throws exception
var cellRange = Module.ExcelApp.Range[index];



But accessing the index using ExcelApp.Range sometime gives comexception, which makes sense as using the COM Object from xll is not supported. Can you advise me how i can access the range object in this case.

Also can you give me some link to understand the other type of ADXExcelWorksheetFunction for e.g

ADXExcelWorksheetFunction.GetCell
ADXExcelWorksheetFunction.GetWorkbook

How i can use these functions and get the mentioned values ?
Posted 09 Sep, 2020 02:43:10 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Ashim,

XLL does not work well with COM objects like ExcelApp.Range. So, I would advise you not to port Excel Automation to XLL. These are slightly different technologies.


ADXExcelWorksheetFunction.GetCell
ADXExcelWorksheetFunction.GetWorkbook

1. GetWorkbook - returns information about an open workbook
2. GetCell - returns information about a cell or a rannge of cells

Unfortunately, XLL functions are not well documented. Please search for the 'Financial Applications using Excel Add-in Development in C / C++' book in the Internet. It provides detailed information about XLL fuinctions.
Posted 09 Sep, 2020 05:54:47 Top