Selecting printer

K

klav

I'm trying to select a specific printer only for the Word session I'm using
and leave the default printer for all other applications alone.

What I'm doing is when the user clicks on the print button of my custom
toolbar in Word, I utilize the "activeprinter=printerB" command, print the
document and then immediately change it back using the
"activeprinter=printerA" command again to set it back to what it was before
printing the document.

What's happening is that even though I'm changing the printer back to
"printerA" immediately after printing the document, if I leave that session
of Word open and open another application, say Excel, the printer for that
application is set to PrinterB, instead of PrinterA.

What is the best way of handling something like this?
 
D

Dave Lett

Hi Klav,
I can't replicate your problem with my test routine:

Dim sActivePrinter As String
sActivePrinter = ActivePrinter
ActivePrinter = "Canon iR2200-3300 PCL6 on NE03:"
ActivePrinter = sActivePrinter

Can you share the relevant code?

Dave
 
J

Jonathan West

klav said:
I'm trying to select a specific printer only for the Word session I'm
using
and leave the default printer for all other applications alone.

What I'm doing is when the user clicks on the print button of my custom
toolbar in Word, I utilize the "activeprinter=printerB" command, print the
document and then immediately change it back using the
"activeprinter=printerA" command again to set it back to what it was
before
printing the document.

What's happening is that even though I'm changing the printer back to
"printerA" immediately after printing the document, if I leave that
session
of Word open and open another application, say Excel, the printer for that
application is set to PrinterB, instead of PrinterA.

What is the best way of handling something like this?

Changing the selected (current) printer in Word without changing the system
default printer
http://www.word.mvps.org/FAQs/MacrosVBA/ChangeCurPrinter.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
Top