Correct Interop.Excel dll version issues

thebatfink

Well-known member
Joined
Mar 29, 2012
Messages
47
Programming Experience
Beginner
Hi,

I have a windows form application that interacts with MS Excel. There is a reference in the project to Microsoft.Office.Interop.Excel v14.0.0.0. The machines that use this app all have Office 2010 installed.

Recently the machines all had Lync 2013 installed - but they all still use the normal Office Suite 2010 for Word / Excel / Outlook etc.

What I am seeing is that when Lync is installed, it is creating a registry key referencing v15 of the Interop.Excel.dll - but because Excel 2013 isn't installed the dll is not actually located or registered on the machine. I believe that it's trying to grab the newest version of the dll it thinks is available v15 and in reality it is not any where on the machine. I confirmed this behaviour by deleting the registry key which references v15, the app runs perfectly again.

So deleteing the key is a solution, but it isn't very robust. Not everyone has sufficient access on the machine they are using to delete the key. It can be deleted for them but I keep seeing the key being recreated! I think Office or Windows updates or something is causing the key to be re-entered..

So my question is - how do I force the app to use v14 regardless of what it believes is installed?

Any help would be greatly appreciated!!

EDIT: This is the error I am seeing (which goes away when I delete the v15 reg key)

VB.NET:
Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D
 
Last edited:
Back
Top