Solved

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

Posted on 2004-04-19
7
341 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
ID: 10865717
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
ID: 10866896
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
ID: 10870671
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
ID: 10870678
Another thing is to force garbage collection:

GC.Collect()

Bob
0
 
LVL 2

Expert Comment

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

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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