5

Background

My office has used Office 2010 for quite some time, and I have written an application to generate some Excel files that we upload to a web site. Recently, our company decided to go with Office 365. So, on my development machine I had 2010 and 365 (whatever version that is), as well as Visual Studio 2017.

My company is assuredly going to require that all non-365 versions of office be removed, so today, I uninstalled 2010 to see what breaks.

The Issue

I fixed the references in the project to point to the correct objects now. I have a reference to Microsoft Excel 16.0 Object Library, and I ended up having to modify statements like

Dim ExApp AS Excel.Application= new Excel.Application

to

Dim ExApp AS Microsoft.Office.Interop.Excel.Application= new Microsoft.Office.Interop.Excel.Application

and now the code compiles with no errors. However, when I run it, I get the following error on the above statement:

System.Runtime.InteropServices.COMException: 'Retrieving the COM class factory for component with CLSID
{00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered
(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).'

I am not sure why.

Internet searches on that error are typically really old, and most describe trying to run the application on a machine where Office is not installed. I can't run it on my development machine in debug mode.

Doug Sholly
  • 123
  • 1
  • 10
  • Try: `Dim excelType As Type=System.Type.GetTypeFromProgID("Excel.Application") : Dim app As Microsoft.Office.Interop.Excel.Application=CType(System.Activator.CreateInstance(excelType), Microsoft.Office.Interop.Excel.Application)`. If that works, then the interop assembly version is not in-synch with the installed Excel version. – TnTinMn Jan 14 '20 at 16:14
  • Please refer to [this article](https://social.msdn.microsoft.com/Forums/en-US/b422cbe3-d70d-4447-ad82-73c638479687/does-microsoftofficeinteropexcel-14000-support-the-office-365-proplus?forum=exceldev) for more details. It says that you need to install Visual Studio Tools for Office Runtime to run the solution on multiple version of office. – Julie Xu-MSFT Jan 15 '20 at 10:07

0 Answers0