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

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
LVL 3
mte01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fahad MukhtarDistinguished EngineerCommented:
are you properly QUITTING from all the word application instances that you create in your application?
0
rameedevCommented:
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
mte01Author Commented:
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Fahad MukhtarDistinguished EngineerCommented:
Call the Quit() Method after closing the worddocument

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mte01Author Commented:
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
mte01Author Commented:
>>Desp

Your method worked...thanks for your help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.