• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 401
  • Last Modified:

How to kill excel process kill....

Hi

I want to kill the excel process when it go's to exception handling, because when i get exception for some reason it returns back to my application, but the excel is still running in process.
0
Adnan
Asked:
Adnan
  • 2
1 Solution
 
AdnanAuthor Commented:
i fixed it ;)

 ArrayList listExcelProcIDs = new ArrayList();
foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcessesByName("EXCEL"))
                {
                    if (!listExcelProcIDs.Contains(proc.Id))
                        proc.Kill();
                }
0
 
AdnanAuthor Commented:
another solution here: ;)*

Process[] process = Process.GetProcessesByName("Excel");
                for (int i = 0; i < process.GetLength(0); i++)
                {
                    //kills excel process
                    process[i].Kill();
                }    
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now