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 / December 2007

Tip: Looking for answers? Try searching our database.

Printer Toolbar Button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brenda A. Reid - 03 Dec 2007 18:51 GMT
I'd like to add a couple of printer buttons to my toolbar that I could use
to print to different printers.  Word XP keeps the printer I changed it to
as my default.  Ideally I'd like the macro/button to ( for clarity I will
name the printers 933 (my default) and colour):

   Get the name of my default printer which is 933
   Change to a different specific printer (colour) and print the document
   Change my default printer back to 933

Tks.
Brenda
Jean-Yves - 04 Dec 2007 13:51 GMT
Hi Brenda

In the immediate window, try
? application.ActivePrinter
should give you the name you want.

Regards
JY

> I'd like to add a couple of printer buttons to my toolbar that I could use
> to print to different printers.  Word XP keeps the printer I changed it to
[quoted text clipped - 7 lines]
> Tks.
> Brenda
zkid - 08 Dec 2007 00:48 GMT
Here is the code to do as you ask.  If you need help adding new toolbar
buttons and assiging macros, please see the standard Word help menu (not the
VBA help) and look under toolbars, add buttons....

Switch to the non-default printer to which you wish to do the printing.  
Then, the VBA mode use Jean-Yves' code regarding determining the proper name:
? application.ActivePrinter (It's Ctrl+G or View, Immediate Window)

Copy the name (don't include the ending colon), and then switch back to your
default printer.

Dim sCurPrinter as string

sCurPrinter = ActivePrinter  'This is your default if you haven't switched

   ActivePrinter = "plug in the text you copied from the immediate window
between the quotes"

'If you want to control the paper bins, you can do something like this
'Note: bin names are printer-dependent

   With ActiveDocument.PageSetup
       .FirstPageTray = wdPrinterLowerBin
       .OtherPagesTray = wdPrinterLowerBin
   End With

'If you want the user to be able to print only parts of the document,
'or multiple copies, etc., use the following code.  User will click send doc
to print

   Dialogs(wdDialogFilePrint).Show

'Or, to just print the document without user-intervention, use this code:

Application.PrintOut FileName:=""

ActivePrinter = sCurPrinter 'Switches printer back to your default

'You might want to find out the name of the default printer just to be sure
and use
'that instead of sCurPrinter (again, use Jean-Yves' immediate window code to
'do so)

> Hi Brenda
>
[quoted text clipped - 16 lines]
> > Tks.
> > Brenda
 
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.