kill the winword.exe process in the task manager..

Posted on 2006-04-26
Last Modified: 2013-12-03
i am using .net to generate a word report.
the thing is that after generating many reports, i opened the task manager and i saw almost 20 process WINWORD.exe
is there something that needs to be done at the end of the code. and can i access the task manager to kill all these processes.?
Question by:mte01
    LVL 19

    Expert Comment

    are you properly QUITTING from all the word application instances that you create in your application?
    LVL 5

    Assisted Solution

    If you want to kill the winword process you could do something like this

    Process[] pArr = Process.GetProcessesByName("WINWORD");

                      foreach(Process pTemp in pArr)

    include the system.Diagnostics namespace in your code
    LVL 3

    Author Comment

    having doc = WordApp.Documents.Add()

    i am putting at the end of my code this:
    doc = Nothing
    WordApp = Nothing

    is there anything that i need to add??
    LVL 19

    Accepted Solution

    Call the Quit() Method after closing the worddocument

    WordApp .Quit(Word.WdSaveOptions.wdDoNotSaveChanges)
    doc = Nothing
    WordApp = Nothing
    LVL 3

    Author Comment

    my code is, and wi wasnt capable of catching the processes.
     Dim parr As Process() = Process.GetProcessesByName("WINWORD") 'this didnt work and WINWORD.EXE didnt work also..
    Imports System.Diagnostics
    parr.Length is always = 0

    Dim parr As Process() = Process.GetProcessesByName("WINWORD.EXE")
                For i As Integer = 0 To parr.Length - 1

    any idea why is that??
    LVL 3

    Author Comment


    Your method worked...thanks for your help!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    This article is filled with multiple code samples and explanations for mathematical calculations. They are as follows: 1. General tips 2. Quadratic formula 3. Object collision 4. Projectile path General Tips       Here are some of my tips f…
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    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

    17 Experts available now in Live!

    Get 1:1 Help Now