shrug-l: SOLUTION to Default printer question
Fri, 14 Jan 2005 10:37:15 -0500

<FONT face=3D"Default Sans Serif, Verdana, Arial, Helvetica, sans-serif" si=
ze=3D2><DIV>Jay: Alternative method is to use following Windows script host=
ing protocol</DIV><DIV>executed as Vbscript. The WSH protocol is universal =
to all Windows 2000, XP OS.</DIV><DIV>&nbsp;</DIV><DIV>1. Open Notepad and =
enter the following script lines.</DIV><DIV>2. In line "WshShell =3D", ente=
r the fullpath to your application exe file.</DIV><DIV>3. Save the Notepad =
file with a (.vbs) extension (not .txt).</DIV><DIV>4. Make a shortcut of th=
e vbs script in your desktop, and rename to your application name. ex: Word=
, Excel, etc.</DIV><DIV>5. Nexttime you use Word or Excel or ArcMap, just d=
ouble-click the short cut.</DIV><DIV>&nbsp;</DIV><DIV>The vbscript uses Win=
dows Script Hosting objects to set</DIV><DIV>your default printer to whatev=
er; launches your application</DIV><DIV>from a shell and then closes the sh=
ell.</DIV><DIV>&nbsp;</DIV><DIV>Make a short cut for each of your applicati=
on and just remember to</DIV><DIV>use the shortcut instead.&nbsp; Right cli=
ck on shortcut and add the icon image</DIV><DIV>of the application and you =
will not be confused.</DIV><DIV>-------------------------------------------=
-----------</DIV><DIV>Option Explicit<BR>Dim Objdefprnt,WshShell<BR>'<BR>' =
Using WsHost script objects to set default printer </DIV><DIV>' MAKE SURE T=
\bigorg\HP" target=3Dblank>\\bigorg\HP</A> 8500 LS"<BR>Set Objdefprnt =3D W=
script.CreateObject("Wscript.Network")<BR>ObjdefArc.SetDefaultPrinter "<A h=
ref=3D"file://\\Servername\Printername" target=3Dblank>\\Servername\Printer=
name</A>"<BR>'<BR>' Create a WsH shell and run your applications<BR>Set Wsh=
Shell =3D Wscript.CreateObject("Wscript.Shell")<BR>'</DIV><DIV>' It is very=
 important to triple quote the fullpath as WSH </DIV><DIV>' truncates long =
paths!</DIV><DIV>WshShell.Run """C:\Program Files\ArcGIS\Bin\ArcMap.exe"""<=
BR>'</DIV><DIV>' This only echos a message. Not important and can be commen=
ted out.</DIV><DIV>Wscript.Echo "Set default printer to ..."<BR>'<BR>' Clos=
e the shell so you don't have this running as a process<BR>Wscript.quit</DI=
><DIV>Good question.&nbsp; Have fun!</DIV><DIV>&nbsp;</DIV><DIV>H.&nbsp;Ern=
<BR><DIV><BR></DIV><FONT color=3D#990099>-----shrug-l-admin@lists.dep.state= wrote: -----<BR><BR></FONT>To: &lt;;=
<BR>From: "Jay Johnson" &lt;;<BR>Sent by: sh=<BR>Date: 01/14/2005 09:27AM<BR>Subject: s=
hrug-l: SOLUTION to Default printer question<BR><BR>All,<BR>Thanks to all w=
ho responded and KUDOS to John Marquez for pointing me<BR>in the right dire=
ction!  I'm not a VBA wiz by any means, but with John's<BR>encouragement I =
was able to figure out the following:<BR><BR>1) In MSWord go to Tools|Macro=
|Visual Basic Editor. Right-click on<BR>Normal, insert|module<BR>and insert=
 the following code:<BR><BR>Public Sub SetPrinter=5FandPrint()<BR>Dim thePr=
inter<BR>thePrinter =3D Application.ActivePrinter<BR>Application.ActivePrin=
ter =3D "ColorPro"<BR>ActiveDocument.PrintOut<BR>Application.ActivePrinter =
=3D thePrinter<BR>End Sub<BR><BR>2) Compile the code, save Normal, and clos=
e the VBE window.<BR><BR>3) Add a new button that launches the macro above =
(Tools, Customize,<BR>Commands, Macros, drag new macro to a toolbar).<BR><B=
R>3) Remove the default "PRINT" button from the interface (optional, but<BR=
>recommended to avoid confusion).<BR><BR>The macro provides this functional=
ity:<BR>  determines the pre-existing default printer<BR>  temporarily sets=
 the printer to the specific printer I want as<BR>default for MSWord (in th=
is case "ColorPro")<BR>  prints the active document<BR>  resets the default=
 printer back to the previously defined default<BR>printer<BR><BR>This is a=
ll the functionality I need - you may need to develop the code<BR>further i=
f you need additional functionality<BR><BR>CAVEATS:  Code is provided as an=
 example only; code as shown may only<BR>work in MSWord - further testing w=
as not done; use code at your own<BR>risk; TLCGIS isn't liable if anything =
blows up as a result of<BR>implementing this code; keep code away from chil=
dren and small animals.<BR><BR><BR><BR>Jay Johnson<BR>Leon County Public Wo=
rks<BR>Tallahassee/Leon County Interlocal GIS<BR>(850) 488-8003<BR><BR>&gt;=
&gt;&gt; ORIGINAL QUESTION&gt;&gt;&gt;<BR>Does anyone know if it is possibl=
e to set different default printers<BR>on an application-by-application bas=
is?  It would be great to have a<BR>large format plotter set as the default=
 printer in ArcGIS but have a<BR>laser-jet set as default for Word and Exce=
l.<BR><BR>I know I'm not the only one who has sent Word documents to the pl=
otter<BR>by accident...<BR><BR>Jay Johnson<BR>Leon County Public Works<BR>T=
allahassee/Leon County Interlocal GIS<BR>(850) 488-8003<BR><BR>=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F<BR>SHRUG-L mailing l=
ist<BR><BR><a href=3D"http://lists.dep.state.f=" target=3Dblank>