Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel don't quit in ASP.net Code
Hi!
I am unable to close my Excel-Task in the following ASP.net Code: oMissing = System.Reflection.Missing.Value objXL = Server.CreateObject("Excel.Application") objWB = objXL.WorkBooks.add("AuslastungAuftrag.xlt") objBooks = objXL.Workbooks objWS = objWB.Worksheets(1) 'i need it for Range-Operations objXL.visible = False objXL.Cells(2, 1).Value = "this" objXL.Cells(2, 2).Value = "is" objXL.Cells(2, 3).Value = "a test" objWB.SaveAs(Me.sPathReports & sFileName) 'Closing and to releasing the Com-Objects While (System.Runtime.InteropServices.Marshal.ReleaseCom Object (objWS) < 0) End While objWS = Nothing objWB.Close(False, oMissing, oMissing) While (System.Runtime.InteropServices.Marshal.ReleaseCom Object (objWB) < 0) End While objWB = Nothing While (System.Runtime.InteropServices.Marshal.ReleaseCom Object (objBooks) < 0) End While objBooks = Nothing objXL.Quit() While (System.Runtime.InteropServices.Marshal.ReleaseCom Object (objXL) < 0) End While objXL = Nothing 'Garbage Collection GC.Collect() System.GC.WaitForPendingFinalizers() After calling this Code 5-times, 4 Excel Processes will be closed and one is still remaining. Without the "ReleaseComObject"-Call none of the processes will be closed. BUT: Sometime it works properly. Yesterday it worked fine - then i added some ADO-Code to fill the Excel-Table with SQL-Data. After this i became the problem. Is it magic.... :-) Any Idea? Thx, Andreas |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel quit opening | Excel Discussion (Misc queries) | |||
can't quit excel | Excel Discussion (Misc queries) | |||
Excel won't quit | Excel Discussion (Misc queries) | |||
Can't get Excel to quit | Excel Programming | |||
Excel won't quit | Excel Programming |