donishere
Programmer
- May 7, 2002
- 101
I am trying to write a simple ASP page that will open an existing spreadsheet on the server, modify a few cells, and then save it.
Instead, IE just sits there spinning. Eventually, the page finishes loading, but the Excel spreadsheet remained unchanged.
What's going on?
Code:
Dim xlapp ' Our Excel App
Dim wb ' Our Workbook within the Excel App
Dim ws ' Our Worksheet within the Workbook
Dim crt ' The chart object
Dim SourceRange ' The Source Range for the chart object
Const xlWorkSheet = -4167
Const xlLineMarkers = 65
' -- Create an instance of Excel Application
Set xlapp = Server.CreateObject("Excel.Application")
xlapp.Workbooks.Open ("C:\Inetpub\[URL unfurl="true"]wwwroot\charts\SystemsUptime.xls")[/URL]
xlapp.Application.Visible = False
Set ws = xlapp.ActiveWorkbook.Sheets("Internet")
' -- Insert data
ws.Range("K21").Value = "Jan"
ws.Range("K22").Value = "Feb"
ws.Range("K23").Value = "Mar"
ws.Range("K24").Value = "Apr"
ws.Range("K25").Value = "May"
ws.Range("K26").Value = "June"
ws.Range("K27").Value = "July"
ws.Range("K28").Value = "Aug"
ws.Range("K29").Value = "Sep"
ws.Range("K30").Value = "Oct"
ws.Range("K31").Value = "Nov"
ws.Range("K32").Value = "Dec"
ws.SaveAs "C:\Inetpub\[URL unfurl="true"]wwwroot\charts\SystemsUptime.xls"[/URL]
Set ws = Nothing
Set wb = Nothing
' -- Quit Excel to conserve resources
xlapp.Quit
Set xlapp = Nothing
Response.Write "THE END"
Instead, IE just sits there spinning. Eventually, the page finishes loading, but the Excel spreadsheet remained unchanged.
What's going on?