Problem with writing data to excel
Hi All,
I am writing data to Excel file using below code:
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlWorkBook = New Excel.Application().Workbooks.Open("C:\Practice.xl s")
xlWorkSheet = xlWorkBook.ActiveSheet
xlWorkSheet.Cells(1, 1) = "Hello world"
xlWorkBook.Save()
xlWorkBook.Close()
I have included the Interop.Excel.dll and Interop dll as well in the bin folder.
and have added the Reference of "Microsoft Excel 11.0 object Library".
This code is working fine on the development machine. But on the server its giving below error error.
"Retrieving the COM class factory for component with CLSID 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 {00024500-0000-0000-C000-000000000046}
failed due to the following error: 80040154."
On the server microsoft office is not installed, so i m guessing if that is not causing the problem.
Can you please tell me how to resolve this problem. what is the trick.
Thanks
utyk
|