COMException error: 80040154 Class not registered in C#


I'm trying to make a application which will print some values to the excel file, for this I'm trying to use the Microsoft.Office.Interop.Excel library but whenever I try to create a object as mentioned below

Application xlApp = new Application();

I'm getting COM exception

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 have Microsoft Office 365 installed in my machine and also PIA are available in C:\Program Files (x86)\Microsoft Visual Studio\Shared\Visual Studio Tools for Office\PIA.

Is this right way to initalize the object.

asked on Stack Overflow Sep 28, 2020 by Gnrgy Dev

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0