Access an Excel property from an XLL add-in ...

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

Access an Excel property from an XLL add-in ...
 
Dragon Fly




Posts: 76
Joined: 2011-07-27
Hi,

I have a COM add-in and an XLL add-in in my project. Is it safe to access an Excel property (in the COM add-in) from the XLL add-in? For example:

In the COM add-in:
public bool IsDate1904
{
get
{
if (ExcelApp.ActiveWorkbook != null)
{
return ExcelApp.ActiveWorkbook.Date1904;
}

return false;
}
}

In the XLL add-in:
public static object Test (string input)
{
// Get the property from the COM add-in.
bool isDate1904 = AddInModule.CurrentInstance.IsDate1904;
...
}

Thank you.
Posted 23 Apr, 2012 08:19:57 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Hi,

I suppose this may cause an issue when a workbook referencing your XLL is being loaded and the COM add-in is not loaded yet. Whether the above is true or not can be found by testing; I suggest that you test the project described in HowTo: Create a COM add-in, XLL UDF and RTD server in one assembly. Note that test results may depend on the Excel version used.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 23 Apr, 2012 08:38:02 Top