K
kfengbest
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.
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.