Link to home
Start Free TrialLog in
Avatar of mte01
mte01Flag for Lebanon

asked on

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
Avatar of Fahad Mukhtar
Fahad Mukhtar
Flag of Pakistan image

are you properly QUITTING from all the word application instances that you create in your application?
SOLUTION
Avatar of rameedev
rameedev
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mte01

ASKER

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??
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mte01

ASKER

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??
Avatar of mte01

ASKER

>>Desp

Your method worked...thanks for your help!