By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

Print Word doc to lower tray - Access 2003

P: n/a
Hi

My database is filling a Word docs with data using bookmarks. My client
wants one particular document to print using the lower tray which will hav a
special letterhead loaded in it.

Is this possible using the Printer object in Access? If not, is it possible
any other way?

Here is what I have tried but doesn't seem to work (letter prints from
default tray, only one copy prints):

Public Function PrintLetter() As Boolean
Dim objWord As Object, objMergeDoc As Object
Dim varPrinterName As Variant

PrintLetter = False

On Error Resume Next
Set objWord = GetObject(, "Word.Application")

If Err.Number <> 0 Then
Err.Clear
On Error GoTo Err_Handler
Set objWord = CreateObject("Word.Application")
End If

On Error GoTo Err_Handler
varPrinterName = DLookup("PrinterName", "tblConfig", "ConfigID = 0")
objWord.Visible = True
objWord.Activate

Set objMergeDoc = objWord.Documents.Add("c:\test\test.dot")

With objMergeDoc
.Bookmarks("FullName").Select
objWord.Selection.Text = "test"

If objWord.ActivePrinter <> varPrinterName Then
objWord.ActivePrinter = varPrinterName

DoEvents
Printers(varPrinterName).PaperBin = acPRBNLower
Printers(varPrinterName).Copies = 2
DoEvents

objWord.PrintOut
objMergeDoc.Close False

End With
PrintLetter = True

Cleanup:
Set objMergeDoc = Nothing
Set objWord = Nothing

Exit Function
Err_Handler:
MsgBox "Error : " & Err.Description & ", error number " & Err.Number
Resume Cleanup
End Function
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Word is running as a separate program. When you tell word to
print, you need to tell it which tray to print to. There is
a parameter for the print command.

(david)

"Joe Black" <jo********@hotmail.com> wrote in message
news:ff*******************@news.xtra.co.nz...
Hi

My database is filling a Word docs with data using bookmarks. My client
wants one particular document to print using the lower tray which will hav a special letterhead loaded in it.

Is this possible using the Printer object in Access? If not, is it possible any other way?

Here is what I have tried but doesn't seem to work (letter prints from
default tray, only one copy prints):

Public Function PrintLetter() As Boolean
Dim objWord As Object, objMergeDoc As Object
Dim varPrinterName As Variant

PrintLetter = False

On Error Resume Next
Set objWord = GetObject(, "Word.Application")

If Err.Number <> 0 Then
Err.Clear
On Error GoTo Err_Handler
Set objWord = CreateObject("Word.Application")
End If

On Error GoTo Err_Handler
varPrinterName = DLookup("PrinterName", "tblConfig", "ConfigID = 0")
objWord.Visible = True
objWord.Activate

Set objMergeDoc = objWord.Documents.Add("c:\test\test.dot")

With objMergeDoc
.Bookmarks("FullName").Select
objWord.Selection.Text = "test"

If objWord.ActivePrinter <> varPrinterName Then
objWord.ActivePrinter = varPrinterName

DoEvents
Printers(varPrinterName).PaperBin = acPRBNLower
Printers(varPrinterName).Copies = 2
DoEvents

objWord.PrintOut
objMergeDoc.Close False

End With
PrintLetter = True

Cleanup:
Set objMergeDoc = Nothing
Set objWord = Nothing

Exit Function
Err_Handler:
MsgBox "Error : " & Err.Description & ", error number " & Err.Number
Resume Cleanup
End Function

Nov 13 '05 #2

P: n/a

"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:40***********************@news.syd.swiftdsl.c om.au...
Word is running as a separate program. When you tell word to
print, you need to tell it which tray to print to. There is
a parameter for the print command.

(david)


Hi David

The parameters for PrintOut as it applies to a document are:
Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages,
PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX,
ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth,
PrintZoomPaperHeight

There is nothing that I can see to tell Word which tray to print a document
to, however PrintOut for a MailingLabel object has the LaserTray parameter.

Unfortunately it is a normal document that is being printed. Any
suggestions?

Regards - Joe
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.