Where is the Microsoft.Office.Interop.Excel held?

  • Thread starter Thread starter Dave the Golfer
  • Start date Start date
D

Dave the Golfer

Guest
I have written a program in VB.net which uses EXCEL to create reports as either print outs or as an Excel File.

The program works on my PC and Laptop but when I put it on my colleagues PC it throws up this error;

System.InvalidCastException: 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: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

On further investigation I found that Microsoft.Office.Interop.Excel.dll is in directory C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c on my PC and in C:\Windows\assembly on my colleagues machine.

I tried to add the sub-directories to my colleagues machine, so I could put a copy of the DLL into it but it would not allow me to create the sub-directories.

I used Microsoft Visual Basic 2017 as the IDE. All machines have Office 365.

Is there any way to to put the DLL in the same directories as the program files and reference the DLL in Visual Studio?

Continue reading...
 
Back
Top