Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel ASP/VBA is hanging

Status
Not open for further replies.

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.

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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top