473,385 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Print Word doc to lower tray - Access 2003

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
2 4102
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bill Hymel | last post by:
Access Printing - Just wondering if you have a solution for this problem - I need to be able to print an Invoice with the 'terms and conditions' on the back side of an Invoice. To do this, I...
7
by: Andy Davis | last post by:
I have a table of data in Access 2002 which is used as the source table for a mail merge document using Word 2002 on my clients PC. The data is transferred OK but I've noticed that any dates which...
10
by: Zeljko | last post by:
Hi, I have a form with a tray icon. However, when I minimize the form, it stays visible - not in the task bar (I have showintaskbar property set to false), but in a form of a rectangle sitting...
0
by: srivalli chavali via DotNetMonster.com | last post by:
Hi, I have to print a word document using C#.NET. I also have to customize the printing option, the Printer tray, programmatically. So, I have used the PrintDocument class available in C#....
2
by: Code Monkey | last post by:
I'm about to deploy a program that prints out Word documents. However, due to licensing issues, we don't actaully have Word 2003 or Office 2003 installed on the machine - only the free Word Viewer...
6
by: Julian | last post by:
Hi, I am a very beginner in databases. I created a database table in Access 2003 and OOo 2.03 that includes name, address, postcode, phone numbers etc of our customers. I would like to sort...
12
by: Jchick | last post by:
Boy, this should be a simple bit of code but I can't figure out how to make it happen. I have a CSV file shows up in a directory that has 4 fields that need to be printed on labels. Each line of...
0
by: vandervelde | last post by:
Hi, A couple of machines in the office have recently upgraded to word 2003 and the printing macros for these machines are working intermittently. The macro takes the computer name and a printer...
2
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, #...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.