print word doc from MS word

  • Thread starter Thread starter DRBE
  • Start date Start date
D

DRBE

As a command button on a form I want to print out a report (appointment
letter to client) and as a second part of the command I want it to print of a
questionaire which is in MSWORD format ie to save me having to open word,
open the doc, then print it, before coming back to the database. (the word
doc is the same for all clients, so does not need any merge fields)

can anyone help with the command to print an MS Word doc from a command
button?
 
As a command button on a form I want to print out a report (appointment
letter to client) and as a second part of the command I want it to print of a
questionaire which is in MSWORD format ie to save me having to open word,
open the doc, then print it, before coming back to the database. (the word
doc is the same for all clients, so does not need any merge fields)

can anyone help with the command to print an MS Word doc from a command
button?

Sub PrintWordDoc()
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("C:\Path to
Folder\YourDocName.doc")

objWord.ActiveDocument.PrintOut , _
Background:=False, _
Range:=wdPrintAllDocument
objDoc.Close False

Set objDoc = Nothing
objWord.Quit
Set objWord = Nothing

End Sub
 
Back
Top