Results 1 to 6 of 6

Thread: Word object

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 1999
    Location
    Reynosa, Mexico
    Posts
    274

    Post

    I'm opening a Word object in two diferent ways but, the Instance of Word is still in memory all time later.

    Method 1
    Code:
    Dim objWord As New Word.Application
    objWord.Visible = False
    objWord.Documents.Open "Document.doc"
    objword.Printout
    objWord.Documents.Close
    Set objWord = Nothing
    Method 2

    Code:
    Dim docWord as Object
    Set docWord = CreateObject("Word.Basic")
    docWord.FileOpen ("document.doc")
    docWord.FilePrint
    docWord.FileClose
    Set docWord = Nothing
    I'm using the Word 8 reference. In both cases the Word instance stay on memory. I think the 'Set DocWord = Nothing' is not the correct sentence to close the Word instance.

    Any idea will be deeply apreciated.

    Thanks!


    [This message has been edited by Tonatiuh (edited 12-29-1999).]

  2. #2
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444

    Post

    I have the same problem. I cant get the instance of word to go away.


    ------------------
    I am so skeptacle, I can hardly believe it!

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    You're not using the word.application.quit method. This example uses Word 9.0 (probably work in 8 as well)
    Code:
        Dim wd As Word.Application
        
        Set wd = New Word.Application
        
        wd.Documents.Open "D:\My Documents\Address.doc"
        wd.Documents.Close False
            
        wd.Application.Quit
        Set wd = Nothing
    Winword is removed from memory, as shown by my close program box.

    HTH

    Tom

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 1999
    Location
    Reynosa, Mexico
    Posts
    274

    Post

    Thanks Tom,

    But, I have a nother problem now.

    Code:
    objWord.Documents.Open "Doc1.doc"
    objWord.PrintOut
    DoEvents
    objWord.Documents.Close
    objWord.Quit
    Set objWord = Nothing
    And I recive this message:
    Word is currently printing. Quitting Word will cancel all pending print jobs. Do you want to quit Word?

    If I choose NO. Prints OK but doesn't quit it.

    If I choose Yes. It quits Word OK but doesn't prints.

    Is there any way to know when Word print job has finished?

    Really thanks!

    Happy New Year!

  5. #5
    Lively Member
    Join Date
    Dec 1999
    Location
    Karlsruhe, Germany
    Posts
    122

    Post

    Hi,

    use

    Code:
    objWord.Documents.Open "Doc1.doc"
    objWord.PrintOut False
    DoEvents
    objWord.Documents.Close
    objWord.Quit
    Set objWord = Nothing
    The False parameter after PrintOut prevents Word from printing in background and it will return to your code when printing is fully completed.

    Happy New Year
    Roger

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 1999
    Location
    Reynosa, Mexico
    Posts
    274

    Post

    Thanks for your note Roger,

    Tom, also put the false but, I ignored.

    Thanks to both!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width