Hey all.
I'm creating an access form that prints a Word document. It works great if I step (F8) through the code, but when I run it in real-time, I get a message from Word that says "...quitting Word will cancel print jobs." Obviously the code is running too quick for the document to get to the printer, but how do I make it wait until that happens?
Private Sub cmdWord_Click()
Dim wordApp As Object
Set wordApp = CreateObject("Word.Application"
wordApp.Documents.Open FileName:="c:\mydoc.doc"
wordApp.ActiveDocument.PrintOut
wordApp.ActiveDocument.Close
wordApp.Quit
Set wordApp = Nothing
End Sub
I'm creating an access form that prints a Word document. It works great if I step (F8) through the code, but when I run it in real-time, I get a message from Word that says "...quitting Word will cancel print jobs." Obviously the code is running too quick for the document to get to the printer, but how do I make it wait until that happens?
Private Sub cmdWord_Click()
Dim wordApp As Object
Set wordApp = CreateObject("Word.Application"
wordApp.Documents.Open FileName:="c:\mydoc.doc"
wordApp.ActiveDocument.PrintOut
wordApp.ActiveDocument.Close
wordApp.Quit
Set wordApp = Nothing
End Sub