Excel STILL won't .Quit()

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

OK, now I'm really stumped. I have a ASP.NET w/ C# application that is
using Excel XP to do automation. Everything works just great, but Excel
stays resident in memory after I try to .Quit(). I have read all of the
other posts on this subject and implemented what's been suggested. For
example, I am doing the
System.Runtime.InteropServices.Marshal.ReleaseComObject on every object that
I instantiate, including all ranges that I use, the workbook, etc., and
setting them to null. What is bizarre is that after recompiling, the first
time I run the page, Excel is not resident in memory, but each subsequent
time the page is run, a copy remains in memory. This is the code I'm using:

Microsoft.Office.Interop.Excel.Application xl = new
Microsoft.Office.Interop.Excel.ApplicationClass();

Microsoft.Office.Interop.Excel.Workbook wb = xl.Workbooks.Add(-4167);
//Generic template

//Don't bother doing anything for now

wb = wb.Close(true,"C:\test.xls",null);

xl.Quit();

System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);

System.Runtime.InteropServices.Marshal.ReleaseComObject(xl);

wb = null;

xl = null;



Please help, this is the last thing and we're releasing Monday!



Thanks, Jim
 
Back
Top