80040154: Retrieving the COM class factory for component with CLSID eorr in .NET
Hi,
I am getting the below error while i am using Microsfot excel interop. In my server there no excel installation. With out excel installation i want to export data to excel. So i used excel interop. But i am getting the below error.
Error: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.
I am using the below code. It is working, if the machine have excel installation, But i dont have excel installation in my server.
Please help me to resolve this issue.
Advance Thanks.
Dim lobjExcelApp As Excel.Application
Dim lobjExcelWrkBk As Excel.Workbook
Dim lobjExcelWrkshtFee As Excel.Worksheet
Dim lobjsht As Excel.Worksheet
Dim rowCnt As Integer
Dim colCnt As Integer
Try
lobjExcelApp = New Excel.Application
lobjExcelApp.Visible = False
lobjExcelWrkBk = lobjExcelApp.Workbooks.Open(strSourceFilePath, , ReadOnly:=True)
lobjsht = lobjExcelWrkBk.Sheets("Sheet1")
lobjExcelWrkBk = lobjExcelApp.ActiveWorkbook
lobjsht.Range("A2").CopyFromRecordset(ors)
lobjExcelWrkBk.SaveAs(strDestinationFileName)
lobjExcelApp.Quit()
Catch
End Try
Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET
The whole point of Excel Interop is that you interoperate with Excel. If Excel is not installed then there's nothing to interoperate with, hence the error. If you want to make use of Excel functionality then you need Excel installed. If you can't install Excel then you can't make use of its functionality. In that case you might have to use CSV files, which can be opened in Excel, instead of XLS files.
Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET
Thanks jmcilhinney,
I am using xlsx (Excel 2007). so I am not able to csv as xlsx. The exporting should be xlsx only.
Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET
Quote:
Originally Posted by
Lakshmanarayanan
The exporting should be xlsx only.
Then you'll need to have Excel 2007 installed.
Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET
Thanks jmcilhinney,
Is there any other way to exporting excel with out excel installation.
Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET
Quote:
Originally Posted by
Lakshmanarayanan
Thanks jmcilhinney,
Is there any other way to exporting excel with out excel installation.
If you want to create a XLSX file then you need something that understands the XLSX format to do it. The obvious choice there is Excel itself.
Alternatively, you could use a component that is specifically designed to interact with XLSX files. I'm sure there are .NET components that will do it but I doubt that they're cheap.
The final option would to research the XLSX format, which is open, and write code to create the file yourself. That's not going to be a trivial exercise though, which is why components to do it for you would not be cheap.
Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET
Thanks jmcilhinney,
I will do some analysis regarding this.