how to kill orphaned process in word application using vb.net

I am using a Vb.net application to automate the word Aplication. I
call Application.Quit() and set the object to Nothing but word.Exe is still
running in my task manager. Anyone know how to make it go away.
satyaprakash47Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Bob LearnedConnect With a Mentor Commented:
Also try using System.Runtime.InteropServices.Marshal.ReleaseComObject on each object that you have declared (Workbook, Worksheet, Document, Application, etc.)

Bob
0
 
zulu_11Commented:
Hi,

Before you quit the application, be sure to close all the documents that you have opened..
Document.Close();

I'll be able to tell much better if you could post your code here..

Zulu
0
 
tgannettsCommented:
I have a similar problem with Excel Automation, in that even if I have closed all spreadsheets etc the process is still running. I therefore had to use the following sub which I have modifed for your Word problem:

Public Sub Kill_Word()

        Dim procs As Process() = Process.GetProcessesByName("WINWORD")
        Dim proc As Process

        For Each proc In procs
            If proc.Responding Then
                If proc.MainWindowTitle = "" Then
                    proc.Kill()
                End If
            Else
                proc.Kill()
            End If
        Next proc

End Sub

Tom.
0
 
Bob LearnedCommented:
Another thing is to force garbage collection:

GC.Collect()

Bob
0
 
UncleMidriffCommented:
I just wanted to thank tgannetts for his comment in this thread, as it is just what I was looking for.
0
All Courses

From novice to tech pro — start learning today.