This project has moved. For the latest updates, please go here.

Using Microsoft.Office.Interop.Excel when Excel isn't installed on server

Feb 13, 2012 at 4:01 PM
Edited Feb 13, 2012 at 4:10 PM

First, I'd like to confirm you can manipulate an Excel spreadsheet using Microsoft.Office.Interop.Excel WITHOUT having Excel installed on the web server.  If that's true, I'm receiving the following error:

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)).

when trying to execute the xlApp = New Excel.Applicaiton line below.

Imports Excel = Microsoft.Office.Interop.Excel

Partial Class TankPlanTab4
Inherits System.Web.UI.UserControl
 
Private Sub Test()

        Dim xlApp As Excel.Application
        Dim xlWorkBook As Excel.Workbook
        Dim xlWorkSheet As Excel.Worksheet
        Dim misValue As Object = System.Reflection.Missing.Value

        Try
            xlApp = New Excel.Application
        Catch ex As Exception
            lblErrMsg.Text = ex.Message
            Exit Sub
        End Try

End Sub

End Class

I have Microsoft.Office.Interop.Excel registered as a resource in the project. Does this need to be registered on the web server?

 

 

 

Any guidance on this topic would be greatly appreciated. 

 

 

 

 

Feb 13, 2012 at 4:35 PM
  1. It is NOT possible to use Office.Interop.Excel without having Excel installed on the server.
  2. Even when Excel is installed on the server, Microsoft STRONGLY discourages using Interop in a web environment for many reasons. See this article from Microsoft http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
  3. This is why ClosedXML and tools like it are so desirable.

Good luck.

Feb 14, 2012 at 2:48 PM

Robert,

Thank you very much for your reply. This is an internal application so I moved in another direction by developing a standalone spreadsheet with a data connection and macros.

Thanks again for your expertise.

Gregory A Secen | Sr. Systems Analyst | PPG Flat Glass |' 412-826-2252 | secen@ppg.com

From: roberttanenbaum [email removed]
Sent: Monday, February 13, 2012 12:35 PM
To: Secen, Greg A.
Subject: Re: Using Microsoft.Office.Interop.Excel when Excel isn't installed on server [closedxml:310676]

From: roberttanenbaum

1. It is NOT possible to use Office.Interop.Excel without having Excel installed on the server.

2. Even when Excel is installed on the server, Microsoft STRONGLY discourages using Interop in a web environment for many reasons. See this article from Microsoft http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

3. This is why ClosedXML and tools like it are so desirable.

Good luck.



CONFIDENTIALITY NOTICE:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain confidential information, which also may be legally privileged. Any reliance upon, access to, review, disclosure, copying, forwarding or other distribution of any or all of the contents in this message by others who are not the intended recipients is STRICTLY PROHIBITED. If you are not the intended recipient, please delete the message and all copies and confirm to the sender by email. Your cooperation is appreciated.