From Access, print a word doc

R

RC

Does anyone know a slice of VB code that would let me
print a specific word document by clicking a button in
Access? I have a request to print some standard handouts
in addition to every time we print a certain signup
report from Access. (this way all documents are at the
printer together, and we don't have to remember to pull
copies out of the file. Saves a lot of time.) In the
past I have imported the document into Access as a
report, but this latest request is 4 pages long and
difficult to reformat to look right coming out of
Access. It would be nice if I could just send the word
document to the printer right after the report. Thanks
in advance.
 
S

SA

Sub PrintWordDoc(strPathAndFileName as String)
On Error resume Next
Dim objWord as Object
Dim objDoc as Object
Const wdPrintAllDocument = 0

Set objWord = CreateObject("Word.Application")
objWord.visible = False
Set objDoc = objWord.Documents.Open(strPathAndFileName)
objWord.ActiveDocument.PrintOut , _
Background:=False, _
Range:=wdPrintAllDocument
objDoc.Close False
Set objDoc = Nothing
objWord.Quit
Set objWord = Nothing

End Sub

That should do it
 
R

RC

That works. Thanks. I was getting there, but missed the
bit for opening the document. This really helps.

RC
 
Top