print word doc from MS word

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?
 
F

fredg

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top