Hi all.
I write an asp page to open an excel file then read/write some cell in that file. Here is my source:
Dim xlApp
Dim xlBook
Dim xlSheet
Set xlApp = Server.CreateObject("Excel.Application")
'Set xlBook = xlApp.Workbooks.Add
Set xlBook = xlApp.Workbooks.Open(Server.MapPath(".") & "\a.xls")
Set xlSheet = xlBook.Worksheets(1)
xlApp.Application.Visible = False
With xlApp.ActiveSheet.Cells(1, 1)
.Value = "Test"
.Font.Bold = True
.Font.Name = "Tahoma"
.Font.Size = 16
End With
xlSheet.SaveAs Server.MapPath(".") & "\a.xls"
xlApp.Application.Quit
Response.Write "Finish"
Response.End
When run this asp, an unexcepted error will occur. This code can run well in
VB. Please help.
Thanks!