Help with my printer macro

D

Deejay

I've written the following code and I have two problems:

1) It's always sending the stuff to the Oki printer despite the If command
that says if the active printer is the HP printer it should print it there.

2) After the ActivePrinter runs it changes the default printer rather than
simply make one printer active.

Thanks!

Sub LetterheadPrint()
'
' LetterheadPrint Macro
'
'
MyPrinter = ActivePrinter
If MyPrinter <> "HP LaserJet 4 Plus" Then ActivePrinter = "\\server\OKI
C5600" Else ActivePrinter = "HP LaserJet 4 Plus"
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterUpperBin
End With
ActiveDocument.PrintOut
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterUpperBin
.OtherPagesTray = wdPrinterUpperBin
End With
End Sub
 
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

For more on controlling printers by vba, see the following 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


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