Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.

Posted on 2007-03-30
3
Medium Priority
?
1,721 Views
Last Modified: 2008-01-09
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.

Public Function LoadExcelSheet(ByVal dt As DataTable)
        Try
            Dim xlWorkBook As Excel.Workbook
            Dim xlWorkSheet As Excel.Worksheet

 ****           xlWorkBook = New Excel.Application().Workbooks.Add(Missing.Value)  ***** fails on this line
            xlWorkBook.Application.Visible = True
            xlWorkSheet = xlWorkBook.ActiveSheet

           
            xlWorkSheet.Visible = True
            xlWorkSheet.Minimum = 1
            xlWorkSheet.Maximum = dt.Rows.Count + 1
            xlWorkSheet.Value = 1
            ' This is to access the first work sheet of your application
            xlWorkSheet = CType(xlWorkBook.Worksheets(1), Excel.Worksheet)
            xlWorkSheet.Name = "SampleExcel"
            For i As Integer = 1 To dt.Rows.Count
                For j As Integer = 1 To dt.Columns.Count
                    ' This is to add the Data which retrieved from
                    ' the database into your Excel Sheet.
                    CType(xlWorkSheet.Cells(i, j), Excel.Range).Value2() = dt.Rows(i - 1).ItemArray(j - 1).ToString()

                    'dt.Rows[i-1].ItemArray[j-1].ToString()--> This will retrieve
                    ' data from your datatable's
                    '(i-1)th rows (j-1)st column
                Next
                xlWorkSheet.Value = xlWorkSheet.Value + 1
            Next
            '  MessageBox.Show("Your Process Completed Successfully")
            xlWorkSheet.Visible = False
        Catch e1 As Exception
            '  MessageBox.Show(e1.Message)
        End Try


    End Function

0
Comment
Question by:mathieu_cupryk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Expert Comment

by:Nico
ID: 18823149
I'm quite sure this happens because of a COM+ permission problem.. as in the framework has no access to the COM object. There is lots of info about this on the web.. You might find your answer here: http://www.codeguru.com/forum/printthread.php?t=383912&page=3&pp=15
0
 

Author Comment

by:mathieu_cupryk
ID: 18823929
Still not working.
0
 
LVL 3

Accepted Solution

by:
Nico earned 1500 total points
ID: 18824033
There's a MS article for office automation here that you could check: http://support.microsoft.com/kb/257757/EN-US/


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question