Public Sub mOpenWord()
Dim appWord As New Word.Application
Dim intResponse As Integer
'Open word with specified file
appWord.Documents.Open ("c:\TEST\TEST.DOC"
'print file
appWord.PrintOut
'set default response
intResponse = vbYes
'loop while response is yes
Do While intResponse = vbYes
intResponse = MsgBox("Reprint ?", vbYesNo)
'if reprint is no then close and exit word
If intResponse = vbNo Then
appWord.Documents.Close (False)
appWord.Quit (False)
Set appWord = Nothing
Else
'Reprint document
appWord.PrintOut
End If
Loop
End Sub
There are two ways to write error-free programs; only the third one works.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.