troubleshooting Question

I need assistance using Excel in my ASP.Net 3.5 application

Avatar of mainrotor
mainrotor asked on
ASP.NET.NET ProgrammingVisual Basic.NET
3 Comments1 Solution456 ViewsLast Modified:
Hi Experts,
I have an ASP.Net 3.5 application with VB.Net codebehind.  The application works fine on my machine, but When I deployed it to the Web Server I got the following error:

retrieving the com class factory for component with clsid{00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154

I don't have Excel installed on my the Web Server.  I have included my code so you could see how I use Excel in my application.  Please tell me what's causing this error.

Thanks in advance,
mrotor  


Imports System.Data.OleDb
Imports System.Data
Imports System.Data.SqlClient
Imports System.Runtime.InteropServices


Partial Class BoardReportAutomation
    Inherits System.Web.UI.Page

    Dim objXL As Microsoft.Office.Interop.Excel.Application
    Dim objWkB As Microsoft.Office.Interop.Excel.Workbook
    Dim objSht As Microsoft.Office.Interop.Excel.Worksheet
    Dim objRange As Microsoft.Office.Interop.Excel.Range


Protected Sub cmdFormat_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdFormat.Click



        If Page.IsValid Then
            Try
            'OPEN EXCEL
              objXL = New Microsoft.Office.Interop.Excel.Application
              objWkB = objXL.Workbooks.Open(strExcel)
              objSht = CType(objWkB.Worksheets(1), Microsoft.Office.Interop.Excel.Worksheet)
              objXL.Visible = False

            'DO SOMETHING...

            'Close Excel
              objWkB.Close(False)
              objXL.Quit()
              objWkB = Nothing
              objXL = Nothing


            Catch ex As Exception
                Dim strError As String
                strError = "Error Message: "
                Response.Write("<script language='JavaScript'>alert('" & strError & ex.Message.ToString & "');window.location=self.location;</script>")
                Exit Sub
            End Try
        End If

    End Sub

End Class





ASKER CERTIFIED SOLUTION
Alfred A.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros