Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't kill word process

Status
Not open for further replies.

BeckD

Programmer
Apr 16, 2002
53
0
0
GB
Hi

I'm trying to write a spellchecker and I'm using the MS Word 9 object library. My problem is that I can't seem to close the word object after I've finished with it. This results in many instances of the word process which evenually eats all of my pc's memory.

Here is an example of my code:
Code:
'the variable 'str' is parsed to the function

Dim oWord As New Word.Application
dim bln as boolean

bln = oWord.CheckSpelling(str, , False)
'
'rest of spellcheck stuff
'

oWord.Quit
Set oWord = Nothing

Anyone know what I can do to kill the process? Any ideas appreciated.

Beck
 
Add the following statement in front of the CheckSpelling statement:
Code:
oWord.Documents.Add
Don't ask me why but it seems to work fine...
Perhaps there are other tricks, I've noticed that making the wordapplication visible before checkspelling works too...
Andreas
 
Thanks Andreas, it works.
 
heya,

it has to do with the
Code:
ApplicationClass.Quit(ref object, ref object, ref object)
method. i just spent about two weeks trying to find this answer as well and didn't get it until i saw a tiny blurb in a remote code sample on MSDN. though i can't prove it, i believe it has to do with the first parameter in the
Code:
Quit()
method. it's asking to save changes or not and w/out an available document (which magically pops up when you make your ApplicationClass object visible) the method unfortunately executes w/out any thrown exceptions. but when a Document is added to the
Code:
ApplicationClass.Documents
collection...voila. WINWORD.EXE goes back to bed

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top