Re: Closing of Word Application

From: GeorgeMar (anonymous_at_discussions.microsoft.com)
Date: 09/01/04


Date: Tue, 31 Aug 2004 23:20:25 -0700

Thank you Van

With regards to opening ang closing the Word Application,
is it more efficient to open the Word Application once and
cycle through printing the files or Opening and closing
the Word application for each print?

regards
george

>-----Original Message-----
>No. Set appWord = Nothing simply destroy the reference
to the Word
>application.
>
>You need
>
> appWord.Quit wdDoNotSaveChanges
>
>after you close the doc and before you set the reference
to Nothing.
>
>You should also set docWord to Nothing.
>
>--
>HTH
>Van T. Dinh
>MVP (Access)
>
>
>"GeorgeMar" <anonymous@discussions.microsoft.com> wrote
in message
>news:3ce201c48fbe$33c8c390$a601280a@phx.gbl...
>> I have a procedure that cycles through a list of Word
>> documents and prints them one at a time to the printer.
>> It works but the WINWORD.EXE remains open when viewed in
>> the Task Manager.
>>
>> Here is the part of the procedure that is not working.
>>
>> If Len(Dir(strFilename)) > 0 Then
>> Dim docWord As Object
>> Dim appWord As Object
>>
>> Set appWord = CreateObject("Word.Application")
>> Set docWord = appWord.Documents.Open(strFilename)
>>
>> docWord.PrintOut
>> docWord.Close
>> Set appWord = Nothing
>> End If
>>
>> I thought that Set appWord=Nothing would close
WINWORD.EXE.
>> Anything else I should do?
>>
>> Perhaps I should also run the loop of Word documents
>> inside the opening and closing of appWord rather than
>> opening and closing the Word Application for each
document.
>>
>> Many thanks
>> George
>
>
>.
>



Relevant Pages

  • Re: Word 2000 size limitations
    ... Win XP, Word 2007, dual-core PC: ... When opening the document, Word takes up to a couple of minutes to count the ... When closing a document, nothing seems to happen sometimes. ... If you have no 2003 pro at hand, try a round-trip save through HTML or RTF. ...
    (microsoft.public.word.docmanagement)
  • Re: Error message when closing Word 2007
    ... If it does it when opening other documents and closing Word but it is OK in Safe Mode, it suggests an incompatible third party add-in as the most likely cause. ... Something else that I have discovered, I just used Remote Desktop to connect ... >> the error message I get when I shut down Word. ...
    (microsoft.public.word.application.errors)
  • Re: Memory problem - writing to database
    ... >connection open to execute your SP on, ... I will try it with opening ... and closing them as data comes in. ... Yes, it was the recordset, because now the memory usage ...
    (microsoft.public.vb.general.discussion)
  • Re: Blank records when form closes
    ... Ok, most of the time I will get a blank just opening and closing the form, ... > your subform code... ... >>I have a data entry form that enters data in a table, ...
    (microsoft.public.access.gettingstarted)
  • Forms missing from "All Forms" in Customize
    ... After opening those new forms a number of ... design is to close the database and re-open ... closing the forms and cannot make the tables lock up. ... It is all very bizarre and confusing. ...
    (microsoft.public.access.forms)