I’m writing an Excel-addin that implements custom Excel functions using XLAutomationAddin.
In the Excel2000 unit you can use the ExcelApplication.Caller property to ascertain the ExcelRange that called your custom function.
However the definition of the Excel2000.pas typelib says that I need to use
property ExcelApplication.Caller[Index: OleVariant; lcid: Integer]: OleVariant;
No matter what I try I cannot get this to work because Excel keeps on refusing any parameters that I put in.
I know I can input 0 OR LOCALE_USER_DEFAULT into lcid, but what does Excel want for the Index parameter?
The solution is to cast the ExcelApplication into an OleVariant.
Like so: