Change Print Tray (Word 2003)

O

Orion Cochrane

I was trying to write a DocumentBeforePrint macro, and it wouldn't work. I
was told by the VBA Help menu that I should use a Class Module and put some
stuff in there. Basically, here is what I want:

Private Sub App_DocumentBeforePrint(ByVal Doc as Document, Cancel as Boolean)
Dim Tray as VBMsgBoxResult
If Options.DefaultTray <> "Use printer settings" Then
Tray = MsgBox ("Print using default tray?", vbQuestion + vbYesNo, "Print")
If Tray = vbYes Then Options.DefaultTray = "Use printer settings"
End If

I do not understand how to work with Class Modules, so if you can fill in
the blanks, that would be great.

PS: Type in DocumentBeforePrint in VBA Help to see what I am talking about.
 
D

Doug Robbins - Word MVP

See the article "Changing the selected (current) printer in Word without
changing the system default printer" at:

http://www.word.mvps.org/FAQs/MacrosVBA/ChangeCurPrinter.htm

and the following articles by fellow MVP, Jonathon West

Controlling the Printer from Word VBA
Part 1: Using VBA to Select the Paper Tray
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101

Controlling the Printer from Word VBA
Part 2: Using VBA to control Duplex, Color Mode and Print Quality
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=116

Controlling the Printer from Word VBA
Part 3: Dealing with Different Paper Sizes
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=132

Controlling the Printer from Word VBA
Part 4: Getting printer driver details
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=183



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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