How to kill excel process kill....

Posted on 2009-02-11
Last Modified: 2012-06-27

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.
Question by:Adnan

    Accepted Solution

    i fixed it ;)

     ArrayList listExcelProcIDs = new ArrayList();
    foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcessesByName("EXCEL"))
                        if (!listExcelProcIDs.Contains(proc.Id))

    Author Comment

    another solution here: ;)*

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now