Results 1 to 7 of 7

Thread: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    5

    Thumbs up 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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    5

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET

    Quote Originally Posted by Lakshmanarayanan View Post
    The exporting should be xlsx only.
    Then you'll need to have Excel 2007 installed.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    5

    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.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET

    Quote Originally Posted by Lakshmanarayanan View Post
    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    5

    Re: 80040154: Retrieving the COM class factory for component with CLSID eorr in .NET

    Thanks jmcilhinney,

    I will do some analysis regarding this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width