A
Administrator
Hi,
My web development server is a Windows 2000 SP4 system.
Had created an aspx page with the following code which I had extracted from
1 of the Microsoft websites:
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
'Add data to cells of the first worksheet in the new workbook.
oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "Last Name"
oSheet.Range("B1").Value = "First Name"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = "Doe"
oSheet.Range("B2").Value = "John"
'Save the Workbook and quit Excel.
oBook.SaveAs("C:\Temp\Book1.xls")
oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
GC.Collect()
When I attempted to run & debug the aspx page, I encountered the following
error message on the statement,
oExcel = CreateObject("Excel.Application"):
System.Exception was unhandled by user code
Message="Cannot create ActiveX component."
Source="Microsoft.VisualBasic"
StackTrace:
at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId,
String ServerName)
at ASP.createexcel_aspx.Button1_Click(Object sender, EventArgs e) in
C:\Inetpub\ASP\CreateExcel.aspx:line 18
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint
I had also tried the same code on another WinXP system where there is
Microsoft Excel installed & it worked out fine.
Thinking I have to install Microsoft Excel on the Win2000 system as well,
but it gave the same error message after I had installed Microsoft Excel.
Anything I had missed out?
Thanks in advance.
Regards,
Michael.
My web development server is a Windows 2000 SP4 system.
Had created an aspx page with the following code which I had extracted from
1 of the Microsoft websites:
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
'Add data to cells of the first worksheet in the new workbook.
oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "Last Name"
oSheet.Range("B1").Value = "First Name"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = "Doe"
oSheet.Range("B2").Value = "John"
'Save the Workbook and quit Excel.
oBook.SaveAs("C:\Temp\Book1.xls")
oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
GC.Collect()
When I attempted to run & debug the aspx page, I encountered the following
error message on the statement,
oExcel = CreateObject("Excel.Application"):
System.Exception was unhandled by user code
Message="Cannot create ActiveX component."
Source="Microsoft.VisualBasic"
StackTrace:
at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId,
String ServerName)
at ASP.createexcel_aspx.Button1_Click(Object sender, EventArgs e) in
C:\Inetpub\ASP\CreateExcel.aspx:line 18
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint
I had also tried the same code on another WinXP system where there is
Microsoft Excel installed & it worked out fine.
Thinking I have to install Microsoft Excel on the Win2000 system as well,
but it gave the same error message after I had installed Microsoft Excel.
Anything I had missed out?
Thanks in advance.
Regards,
Michael.