We help IT Professionals succeed at work.
Get Started

Having Problems with Microsoft Excel 11.0 object library to work on iis 6.0 server using asp.net vb

Last Modified: 2013-11-26
I am trying to create an excel spreadsheet at runtime to be displayed to users over the web.
(Office 2003 has been installed on all computers and iis server)

I have added the refference to "Microsoft Excel 11.0 Object Library" to my VisualStudio 2005 web project which is located on the iis server.

The website is a private site where users must be authenticated..(No problems there just adding background) the site works fine but when i try to create a worksheet i get an error:

****** this is the error displayed in ie when i run the page ****************************

Retrieving the COM class factory for component with CLSID {00020819-0000-0000-C000-000000000046} failed due to the following error: 80040154.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {00020819-0000-0000-C000-000000000046} failed due to the following error: 80040154.

Source Error:

Line 14:     Private Sub CreateSpreadsheet()
Line 15:         thisExcel = New Excel.Application
Line 16:         thisWorkbook = New Excel.Workbook    <-------- Error occurs here
Line 17:         thisExcel.Workbooks.Add("D:\INTERNET\test\Test\Excel_Templates\Forecasting_Template_1.xls")
Line 18:         'thisWorkbook = thisExcel.Workbooks.Open(, )

'this is the code for the page that is run:
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports Excel = Microsoft.Office.Interop.Excel
Partial Class Report_Forecasting_Excel_1
    Inherits System.Web.UI.Page
    'Create Excel Objects
    Dim thisExcel As Excel.Application
    Dim thisWorkbook As Excel.Workbook
    Dim thisWorksheet As Excel.Worksheet
    Private Sub CreateSpreadsheet()
        thisExcel = New Excel.Application
        thisWorkbook = New Excel.Workbook
        'thisWorkbook = thisExcel.Workbooks.Open(, )
        thisExcel.Visible = True
        thisWorksheet = New Excel.Worksheet
        thisWorkbook.Application.Visible = True
        thisWorksheet.Cells(1, 1) = "hello there"
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
End Class

Open in new window

Watch Question
Technical Manager
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE