I have an Excel Addin using Excel-DNA. I recently update my code to switch from Interop to NetOffice.
My code all compiles fine, but when I start the add-in, I get this exception on the first line of code that executes (doesn't seem to matter which line of code it is):
> System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'NetOffice.ExcelApi.Application'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Does anyone have an idea of why this is happening and how I can fix it?
My code all compiles fine, but when I start the add-in, I get this exception on the first line of code that executes (doesn't seem to matter which line of code it is):
> System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'NetOffice.ExcelApi.Application'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Does anyone have an idea of why this is happening and how I can fix it?