MACRO HELP

G

Guest

I created a macro to print certain documents in Excel
after it prints I want the printer to default back to the
original printer not the one I created. I used the below
formula for the macro, but it's not defaulting back, can
you help me with this?

Application.ActivePrinter = "\\albprn01\finlj02 on Ne03:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
ActivePrinter:= _
"\\albprn02\finlj02 on Ne03:", Collate:=True

End Sub
 
J

Jerry W. Lewis

Assign the active printer to a variable before you change it, then
restore it from that variable after you print.

Jerry
 
D

Don Guillett

Here are a couple that might be of use
Sub Color_Printer()
Application.ActivePrinter = "Brother MFC-7000 Series on LPT1:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True,
ActivePrinter:= _
"Brother MFC-7000 Series on LPT1:", Collate:=True
End Sub
Sub HP4Plus()
Application.ActivePrinter = "HP LaserJet 4 Plus on LPT1:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True, _
ActivePrinter:="HP LaserJet 4 Plus on LPT1:", Collate:=True
End Sub
 
G

Guest

Thanks Don, you are the best!
-----Original Message-----
Here are a couple that might be of use
Sub Color_Printer()
Application.ActivePrinter = "Brother MFC-7000 Series on LPT1:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True,
ActivePrinter:= _
"Brother MFC-7000 Series on LPT1:", Collate:=True
End Sub
Sub HP4Plus()
Application.ActivePrinter = "HP LaserJet 4 Plus on LPT1:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True, _
ActivePrinter:="HP LaserJet 4 Plus on LPT1:", Collate:=True
End Sub


--
Don Guillett
SalesAid Software
(e-mail address removed)



.
 
J

Jerry W. Lewis

' save current printer settings
Dim aap, ap
aap = Application.ActivePrinter
ap = ActivePrinter

' add your code here which changes printer settings

' restore printer settings
ActivePrinter = ap
Application.ActivePrinter = aap

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top