Re: Printer Toolbar Button by zkid
zkid
Fri Dec 07 16:48:00 PST 2007
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)
"Jean-Yves" wrote:
> Hi Brenda
>
> In the immediate window, try
> ? application.ActivePrinter
> should give you the name you want.
>
> Regards
> JY
>
> "Brenda A. Reid" <brenda.reid@mcinnescooper.com> wrote in message
> news:utOw61dNIHA.820@TK2MSFTNGP06.phx.gbl...
> > 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
> >
>
>
>