Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Set ActivePrinter to computer's default printer

Status
Not open for further replies.

sparkyrose

Programmer
May 9, 2007
17
0
0
US
Hi all,
I have a simple one-liner that I use to print highlighted selections from worksheets, and I want these to always print to my local printer (which is also the default printer). The problem I have is that if I have previously printed to another printer, that is the ActivePrinter, and my selection goes there.

Is there something I can put before this to reset the ActivePrinter to my default?

Code:
Selection.PrintOut Copies:=1, Collate:=True

Thanks in advance

 
Hi,

Turn on your macro recorder and record changing your printer to the one you want. Include that code prior to your print.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Simple yet brilliant. Thanks.

For the benefit of others, this is what it came up with:

Code:
Application.ActivePrinter = "HP LaserJet 2420 PCL 5 on Ne03:"
    Selection.PrintOut Copies:=1, ActivePrinter:= _
        "HP LaserJet 2420 PCL 5 on Ne03:", Collate:=True

Note that the recorded macro may also include "IgnorePrintAreas:=False" after the Collate bit. Not sure why but this made it fail so I commented it out
 
Thanks for posting your solution.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top