Jeg har fundet noget, der ser ud til at virke. Her laver man et excel-ark i et temp-directory og redirecter til det. Det ser da smart ud syns mig.
<%
Response.Buffer = true
\'************************************************
\'All Credit must be given to:
\'
\'David L. Penton [mailto:lemans70@home.com]
\'
\'(Thanks Dave, again!)
\'************************************************
\'***********************************
\'EXCEL
\'***********************************
dim xls, I, J, tempName, tempPath, tempnum
On Error Resume Next
Set xls = CreateObject(\"Excel.Application\")
With xls
\' Make sure there is no minimized window created
.Application.Visible = False
\' Add a new workbook
.Workbooks.Add
\' Select some cells to put the DATETIME in it
.Range(\"A1:C1\").Select
.Selection.MergeCells = True
.Selection = Now
\' populate some cells
For I = 2 To 15
For J = 2 To 20
tempnum = 12
If J = 15 Then
.Cells(J, I).Value = Sqr(i*j) / (i^tempnum)
ElseIf J = 10 then
.Cells(J, I).Value = (i+j) * (i^tempnum)
Else
.Cells(J, I).Value = (i+j)^2
End If
Next
Next
.Charts.Add
.ActiveChart.ChartType = 67 \'xlLineMarkersStacked100 = 67
\' xlColumns = 2
.ActiveChart.SetSourceData .Sheets(\"Sheet1\").Range(\"B2:O20\"), 2
\' xlLocationAsNewSheet = 1
.ActiveChart.Location 1
With .ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = \"My Kewl Chart number #\" & CStr(tempnum)
.Axes(1, 1).HasTitle = True
.Axes(1, 1).AxisTitle.Characters.Text = \"X axis for you\"
.Axes(2, 1).HasTitle = True
.Axes(2, 1).AxisTitle.Characters.Text = \"Y axis for me\"
End With
With .ActiveChart.Axes(1)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
With .ActiveChart.Axes(2)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
.ActiveChart.HasLegend = True
.ActiveChart.Legend.Select
\' xlBottom = -4107
.Selection.Position = -4107
\' xlDataLabelsShowNone = -4142
.ActiveChart.ApplyDataLabels -4142, False
.ActiveChart.HasDataTable = False
\' Make a path for the file to be saved
tempName = Hour(Now) & minute(now) & second(now) & \".xls\"
tempPath = \"c:\\inetpub\\wwwroot\\testing\\\" & tempName
\' Save the Workbook in my web drive
\'.Application.DisplayAlerts = False
\'.Sheets(\"Sheet2\").Select
\'.ActiveWindow.SelectedSheets.Delete
\'.Sheets(\"Sheet3\").Select
\'.ActiveWindow.SelectedSheets.Delete
\'.Sheets(\"Chart1\").Select
\'.Application.DisplayAlerts = True
.ActiveWorkbook.SaveAs tempPath
\'.ActiveWorkBook.PrintOut 1
.ActiveWorkbook.Close
\' VERY IMPORTANT HERE
\' Quit the Application
\' xls.Quit is NOT enough...is it only the reference to the Excel Object
\' you still have to terminate the Application
.Application.Quit
End With
\' VERY IMPORTANT HERE
\' Release the memory
set xls = Nothing
\'Response.Buffer = true
Response.Redirect \"
http://localhost/testing/\" & tempName
\'Response.Write \"
http://localhost/testing/\" & tempName
%>