WinWord.exe can not exit after automation in VB.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



WinWord.exe can not exit after automation in VB. Here is the step:



1. Execute the following code in VB:

Private Sub Command1_Click()

Dim wrdapp As Word.Application

Set wrdapp = CreateObject("Word.Application")

wrdapp.Visible = True

Set wrdapp = Nothing

End Sub

2. Open a IE, Drag and drop a wor doc file into IE to make sure the
doc is open inside the IE

3. Close the standalone word application created in step 1, and then
close the IE.

4. Open Task Manager-> the WinWord.exe does not quit.



Of course , if we explicitly call Word.Application.Quit to quit word.exe
that may work.

But in our application we could not do that. Because after user opened a doc
using our program, he may close the program

and don't like the word to be closed with our program. He may want to edit
it that close it later.



And it seems that when using IE as host to open word document, it does not
reduce the reference count.

We need to do something additional to reduce the reference in somewhere. But
I have no idea yet currently.



Does anybody have any idea about how to solve it? Thanks in advanced.


.



Relevant Pages

  • Re: Activate Word without starting new Word instance
    ... GetObject as Jezebel described to get an object reference to it. ... can use the Run method of the Word Application object to run the macro. ... > Set wrdApp = GetObject ... >> Set wrdApp = GetObject ...
    (microsoft.public.word.vba.general)
  • WinWord.exe can not exit after automation in VB.
    ... Dim wrdapp As Word.Application ... Set wrdapp = CreateObject ... Open Task Manager-> the WinWord.exe does not quit. ... We need to do something additional to reduce the reference in somewhere. ...
    (microsoft.public.office.developer.automation)
  • Re: Activate Word without starting new Word instance
    ... Late binding ... Set wrdApp = GetObject ... Dim wrdApp as Word.Application ...
    (microsoft.public.word.vba.general)