Just my guess:
Is there some code create a varable (probably at form level) that references
object in Word.Application somewhere between Foam_Load and cmdExit_Click,
which is still alive (not set to Nothing)?
If you simply try to start Word.Application and close it in the same
procedure, like below, I'll bet Word.Application would quit cleanly:
Private Sub cmdTest_Click()
Dim AppWord As Word.Application
Set AppWord=New Word.Application 'You can use CreateObject() if you
wish
MsgBox "Word launched"
AppWord.Quit;
'....................
End Sub
If Word.Application quits correctly here, then find some code in your
project that has something to do with AppWord before cmdExit_Click
"The Roys" <tr*****@hotmail.com> wrote in message
news:oV********************@news-server.bigpond.net.au...
Thanks for your reply, but either way makes no difference. Before exiting,
and while program is dormant the process in the Task Manager (Winword.exe)
does not take up any CPU usage. But as soon as I run the Exit code the CPU
usage goes to 100% and the process is still in the Task Manager.
Every time I run the program a new Winword.exe process begins.
Any ideas ??
"Stephane Richard" <st**************@verizon.net> wrote in message
news:QE******************@nwrdny03.gnilink.net... The first thing I see is that you are using a mix of Early and Late
binding to create your object.
This is your code as it stands: General Declarations
Dim AppWord As Word.Application
Form_Load()
Set AppWord = CreateObject("Word.Application")
cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me
In early binding mode it should be: General Declarations
Dim AppWord As Word.Application
Form_Load()
Set AppWord = New Word.Application
In Late Binding mode (using createobject()) it should be: General Declarations
Dim AppWord As Object
Form_Load()
Set AppWord = CreateObject("Word.Application")
Try the same code to end your word application object as you have with
one of these two declarations (early or late binding). and see if it still
causes a problem.
--
Stéphane Richard
"The Roys" <tr*****@hotmail.com> wrote in message
news:VK********************@news-server.bigpond.net.au... Hi
Im doing something wrong in quitting the Word.Application in my VB
program. I have
General Declarations
Dim AppWord As Word.Application
Form_Load()
Set AppWord = CreateObject("Word.Application")
cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me
When I click Exit to end my program Winword.exe is still running as a
process listed in my Task Manager. Not only is it listed, but the
process is taking up 100% of my CPU usage.
How do I end the Word.Application correctly ???
Thanks
Trevor.