Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Process is not terminated when using C# and com Interrop

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.ReleaseComO bject(ws);
ws = null;
}
if(wb != null)
{
for(int i = 1 ;i < wb.Sheets.Count; i++)
{
((Excel.Worksheet)wb.Sheets[i]).Delete();
}

System.Runtime.InteropServices.Marshal.ReleaseComO bject(wb);
wb = null;
}

if(excelApp != null)
{
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComO bject(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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Excel Process is not terminated when using C# and com Interrop

I am also having this problem exactly as same as Hendrix4578 has mentioned below. It is really killing me. Did anybody have any idea?

thanks
Ramesh

"Hendrix4578" wrote:
[i]
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.ReleaseComO bject(ws);
ws = null;
}
if(wb != null)
{
for(int i = 1 ;i < wb.Sheets.Count; i++)
{
((Excel.Worksheet)wb.Sheets).Delete();
}

System.Runtime.InteropServices.Marshal.ReleaseComO bject(wb);
wb = null;
}

if(excelApp != null)
{
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComO bject(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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Test Terminated Employees fubdap Excel Discussion (Misc queries) 2 September 25th 07 07:54 PM
Can password be removed on Excel WS from terminated employee? pb Excel Discussion (Misc queries) 5 September 8th 06 08:12 PM
Array formula returning terminated employees malik641 Excel Worksheet Functions 4 August 16th 05 03:24 PM
How do I make a process map in Excel? The Hard Worker Charts and Charting in Excel 2 May 24th 05 05:38 PM
How to Quit an Excel process? Joe Brown Excel Programming 0 October 1st 03 06:06 AM


All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"