Cleaning up and more instances of WORD

K

KS

I have a VB6 program looping through DOC-files in a folder
making some statistics on the DOC-files in a Excel-sheet.

When the program is runing I can NOT use WORD for other
purposes because the DOC-files then open in this instans
of Word - sample snip:

Set WrdDoc = WrdApp.Documents.Open(App.Path & "\" & FileN)
', , , , , , , , , , , False)
..
..
.. gathering some statistics til an Excel-sheet
..
WrdDoc.Close False
Set WrdDoc = Nothing

IF I use the parameter Visible=False (commented out here!)
I can NOT use the "WrdDoc.Close False"

If I comments out the "WrdDoc.Close False" I get ALL tilde-
workfiles visible (and it's 10.000'd of files !)

How can I clean up nicely by closing each opened document
AND use Word for other purposes WITHOUT opening the
documents in this extra instance of Word ?

KS, Denmark
 
L

Lars-Eric Gisslén

KS,

I just made a quick test with my dev tool and there were no problems closing
the document. Perhaps you can compare my with your code, even though my code
is not VB.
-----------------------------------------------------
METHOD TestWord() CLASS App

LOCAL oW AS OBJECT

oW := OleAutoObject{"Word.Application.9"}

IF !oW:fInit
warningbox{,"Word","Could not start Word 2000"}:Show()
ELSE
oW:Visible := FALSE
oW:Documents:Add()
oW:Selection:TypeText("This is from V.O.")
oW:ActiveDocument:Close(FALSE)
oW:Visible := TRUE
Infobox{,"Word","Word should have closed the document now"}:Show()
oW:Quit()
ENDIF

RETURN NIL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top