Reference to "Microsoft.Office.Interop.Excel.dll" or "Interop.Excel.dll"

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

Reference to "Microsoft.Office.Interop.Excel.dll" or "Interop.Excel.dll"
 
Kiru Marimuthu


Guest


Hi

I have a couple of questions as below.

1, We are working on the project which has got the reference to "Microsoft.Office.Interop.Excel.dll". When I started a new sample project from scratch, I couldn't find that reference instead I got "Interop.Excel.dll". Please let us know which one is the correct one.


2, We have a scenario where there are two instances of Excel is running we need to identify each of them uniquely. So started to using Excel._Application.Hwnd to identify which instance is sending the messages.

Now from the question 1, when we had reference to "Microsoft.Office.Interop.Excel.dll" it had Excel._Application.Hwndproperty but it is missing in the "Interop.Excel.dll".

Please advice which needs to be used.

Thanks
Posted 18 Jan, 2018 04:43:42 Top
Andrei Smolin


Add-in Express team


Posts: 18816
Joined: 2006-05-11
Hello Kiru,

When you create an Add-in Express COM add-in project, you choose the minimum Office version to support. Your choice is reflected in these ways: 1) see the minOfficeVersionSupported attribute in adxloader.dll.manifest (the loader won't load your add-in in an unsupported Office version) and 2) the chosen version of interops is copied to the Interops folder (within your project folder) and the references to the interop files are created on the add-in project.

Microsoft.Office.Interop.Excel.dll is an interop assembly created by Microsoft; it is available for Office 2002-2013 (2016 uses the same interop as 2013). Interop.Excel.dll is an interop for Excel 2000; it is created by Add-in Express. So, the answer to your first question is: you should choose what version to use.

As to the second question, it occurs because the Excel version referenced by your add-in doesn't have that property. Specifically, Application.Hwnd is available in Excel 2002-2016.


Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2018 06:34:34 Top