G
Guest
How do you stop the Excel proces from running the following code works on some boxes but not others.It seems that it is impossible to terminate the Excel process.
if(ws != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
ws = null;
}
if(wb != null)
{
for(int i = 1 ;i < wb.Sheets.Count; i++)
{
((Excel.Worksheet)wb.Sheets).Delete();
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);
wb = null;
}
if(excelApp != null)
{
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
excelApp = null;
}
System.GC.Collect();
It is not possible for me to use process.kill because the web based application that this used with ddoes not issue admin rights to its users.
if(ws != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
ws = null;
}
if(wb != null)
{
for(int i = 1 ;i < wb.Sheets.Count; i++)
{
((Excel.Worksheet)wb.Sheets).Delete();
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);
wb = null;
}
if(excelApp != null)
{
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
excelApp = null;
}
System.GC.Collect();
It is not possible for me to use process.kill because the web based application that this used with ddoes not issue admin rights to its users.