You add-ins are loading in separate AppDomains. One option is to integrate the COM Add-In into the Excel-DNA add-in. This might be as easy as:
- Add your COM add-in code to your Excel-DNA project,
- Change your add-in class to derive from
ExcelComAddIn
(instead ofIDTExtensibility2
), - Load that class in your
AutoOpen
viaExcelComAddInHelper.LoadComAddIn(...)
.
Otherwise you will need some sort of inter-AppDomain communication. You can set up a Marshal-By-Reference object that you set to the Object
property of the COMAddIn
object corresponding to your loaded add-in, and retrieve that using the COM interfaces from the Excel-DNA add-in.