shrug-l: SOLUTION to Default printer question

Jay Johnson JohnsonJa@mail.co.leon.fl.us
Fri, 14 Jan 2005 09:27:20 -0500


All,
Thanks to all who responded and KUDOS to John Marquez for pointing me
in the right direction!  I'm not a VBA wiz by any means, but with John's
encouragement I was able to figure out the following:

1) In MSWord go to Tools|Macro|Visual Basic Editor. Right-click on
Normal, insert|module
and insert the following code:

Public Sub SetPrinter_andPrint()
Dim thePrinter
thePrinter = Application.ActivePrinter
Application.ActivePrinter = "ColorPro"
ActiveDocument.PrintOut
Application.ActivePrinter = thePrinter
End Sub

2) Compile the code, save Normal, and close the VBE window.

3) Add a new button that launches the macro above (Tools, Customize,
Commands, Macros, drag new macro to a toolbar).

3) Remove the default "PRINT" button from the interface (optional, but
recommended to avoid confusion).

The macro provides this functionality:
  determines the pre-existing default printer
  temporarily sets the printer to the specific printer I want as
default for MSWord (in this case "ColorPro")
  prints the active document
  resets the default printer back to the previously defined default
printer

This is all the functionality I need - you may need to develop the code
further if you need additional functionality

CAVEATS:  Code is provided as an example only; code as shown may only
work in MSWord - further testing was not done; use code at your own
risk; TLCGIS isn't liable if anything blows up as a result of
implementing this code; keep code away from children and small animals.



Jay Johnson
Leon County Public Works
Tallahassee/Leon County Interlocal GIS
(850) 488-8003

>>> ORIGINAL QUESTION>>>
Does anyone know if it is possible to set different default printers
on an application-by-application basis?  It would be great to have a
large format plotter set as the default printer in ArcGIS but have a
laser-jet set as default for Word and Excel.

I know I'm not the only one who has sent Word documents to the plotter
by accident...

Jay Johnson
Leon County Public Works
Tallahassee/Leon County Interlocal GIS
(850) 488-8003