[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-04-26
6
Medium Priority
?
2,185 Views
Last Modified: 2013-12-03
Hi
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.?
thanks
0
Comment
Question by:mte01
  • 3
  • 2
6 Comments
 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 16543342
are you properly QUITTING from all the word application instances that you create in your application?
0
 
LVL 5

Assisted Solution

by:rameedev
rameedev earned 600 total points
ID: 16543391
If you want to kill the winword process you could do something like this

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

                  foreach(Process pTemp in pArr)
                  {
                        pTemp.Kill();
                  }

include the system.Diagnostics namespace in your code
0
 
LVL 3

Author Comment

by:mte01
ID: 16543401
having doc = WordApp.Documents.Add()

i am putting at the end of my code this:
 
doc.Close(Word.WdSaveOptions.wdDoNotSaveChanges)
doc = Nothing
WordApp = Nothing

is there anything that i need to add??
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Accepted Solution

by:
Fahad Mukhtar earned 1000 total points
ID: 16543529
Call the Quit() Method after closing the worddocument

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

Author Comment

by:mte01
ID: 16543727
my code is vb.net, 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
                 parr(i).Kill()
            Next

any idea why is that??
0
 
LVL 3

Author Comment

by:mte01
ID: 16544356
>>Desp

Your method worked...thanks for your help!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
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 …

872 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