Solved

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

Posted on 2004-04-19
7
325 Views
Last Modified: 2007-12-19
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.
0
Comment
Question by:satyaprakash47
7 Comments
 
LVL 6

Expert Comment

by:zulu_11
Comment Utility
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
 
LVL 5

Expert Comment

by:tgannetts
Comment Utility
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
 
LVL 96

Accepted Solution

by:
Bob Learned earned 50 total points
Comment Utility
Also try using System.Runtime.InteropServices.Marshal.ReleaseComObject on each object that you have declared (Workbook, Worksheet, Document, Application, etc.)

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Another thing is to force garbage collection:

GC.Collect()

Bob
0
 
LVL 2

Expert Comment

by:UncleMidriff
Comment Utility
I just wanted to thank tgannetts for his comment in this thread, as it is just what I was looking for.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

10 Experts available now in Live!

Get 1:1 Help Now