[AccessD] Wait For Word To Finish Printing

ACTEBS actebs at actebs.com.au
Wed Nov 10 09:28:12 CST 2004


Guys,

I have a function that prints out numerous Word documents on the fly which I loop through. The problem is the print job hasn't finished and a dialogue box pops up suggesting that "If you close word now the document print job will be cancelled"

The code is as follows:

    With m_objWord
        .ActiveDocument.SaveAs strWrdPath
        
        If gBoolPrintOrNot = True Then
            .ActiveDocument.PrintOut
            DoEvents
        End If
        
        .ActiveDocument.Close
    End With
    
    m_objWord.Quit
    Set m_objDoc = Nothing
    Set m_objWord = Nothing

It works well other than I have to close after I am finished as I don't want to leave variables in memory. Is there any way to wait until word has finished it's job?

I have tried Dev's "ShellWait" function, but that is more geared to batch files rather than a windows app, and it's not the word document that is the process, it's word that is executing the process....

Any guidance much appreciated...

Vlad





More information about the AccessD mailing list