Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Help with my printer macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Deejay - 17 Jun 2007 17:26 GMT
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
Doug Robbins - Word MVP - 17 Jun 2007 20:48 GMT
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

Signature

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

> I've written the following code and I have two problems:
>
[quoted text clipped - 25 lines]
>    End With
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.