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 1").Insert
Wrk.Range("B1:A1").Insert
Wrk.Range("B1:B2").Insert
Wrk.Range("B1:C3").Insert
Wrk.Range("B1 4").Insert

Wrk.Range("A1:A1").Value = 1
Wrk.Range("A1:B1").Value = 2
Wrk.Range("A1:C1").Value = 3
Wrk.Range("A1 1").Value = 4
Wrk.Range("B1:A1").Value = 50
Wrk.Range("B1:B2").Value = 100
Wrk.Range("B1:C3").Value = 120
Wrk.Range("B1 4").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