Solved

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

Posted on 2004-04-19
7
350 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

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…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

752 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