PDA

Click to See Complete Forum and Search --> : Error in the Excel object usage in ASP


daljeet
Jan 16th, 2000, 06:57 PM
I am trying to create a .gif on the fly using the Excel component with the following code.

Set xlSheet = CreateObject("Excel.Sheet")
Set xlApp = xlSheet.Application
Set Wrk = xlApp.Worksheets.Add

Wrk.Range("A1:A1").Insert
Wrk.Range("A1:B1").Insert
Wrk.Range("A1:C1").Insert
Wrk.Range("A1 :D1").Insert
Wrk.Range("B1:A1").Insert
Wrk.Range("B1:B2").Insert
Wrk.Range("B1:C3").Insert
Wrk.Range("B1 :D4").Insert

Wrk.Range("A1:A1").Value = 1
Wrk.Range("A1:B1").Value = 2
Wrk.Range("A1:C1").Value = 3
Wrk.Range("A1 :D1").Value = 4
Wrk.Range("B1:A1").Value = 50
Wrk.Range("B1:B2").Value = 100
Wrk.Range("B1:C3").Value = 120
Wrk.Range("B1 :D4").Value = 70

Set ActiveChart = Wrk.ChartObjects.Add(1, 1, 100, 100).Chart
ActiveChart.ChartType = 65
ActiveChart.HasDataTable = False
ActiveChart.Export "c:\Mychart GIF", "GIF"

The above code works well in Visual Basic but gives an error in the last line if it is run as an ASP file. Please help

Clunietp
Jan 17th, 2000, 11:12 AM
Why don't you export the chart to the dir in which the web page is being processed?

ex: c:\inetpub\wwwroot\..... or similar....

It might have something to do with permissions of your page writing to the local file system on the web server

HTH

Tom