|
-
Feb 15th, 2003, 01:01 AM
#1
Thread Starter
Addicted Member
Can't Stop Excel.exe
I've got a simple COM that creates an excel spreadsheet. The problem is that each time I execute an asp page that calls it, it starts a process excel.exe. The process continues after to COM is distroyed... it even appears to be getting CPU time for a while. Here is the code:
Public Function CreateWorkbook(oRS As Object) As Boolean
Dim goExcel As Excel.Application
Dim oField As ADODB.Field
Dim I As Integer
Dim FName As String
On Error GoTo ExcelError
Set goExcel = New Excel.Application
goExcel.Workbooks.Add
With goExcel.ActiveSheet
I = 1
For Each oField In oRS.Fields
.Cells(1, I).Value = oField.Name
I = I + 1
Next
I = I - 1
End With
goExcel.Range("A2").CopyFromRecordset oRS
goExcel.Range(Cells(1, 1), Cells(1, I)).Select
goExcel.Selection.Font.Bold = True
goExcel.ActiveSheet.Columns("a:z").AutoFit
goExcel.ActiveWorkbook.SaveAs mvarSaveFileName
goExcel.ActiveWorkbook.Close
goExcel.Quit
Set goExcel = Nothing
CreateWorkbook = True
Exit Function
ExcelError:
mvarErrormsg = Err.Description
CreateWorkbook = False
End Function
Any help would be appreciated!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|