Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Working with Multiple Printers.
Written by Allen Wyatt (last updated July 18, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003
You already know that Windows supports multiple printers. Using Excel with multiple printers can be a bother, however, since you must display the Print dialog box, change the printer, and then print the worksheet.
There is a way, however, that you can have one-click printing of your worksheets on a designated printer. To do this, simply create a macro that changes the printer and then prints the worksheets, as shown here:
Sub GoodPrinter() Application.ActivePrinter = "HP LaserJet" ActiveWindow.SelectedSheets.PrintOut Copies:=1 End Sub
When you create this macro on your system, make sure you change the printer name in the second line of the macro. It must exactly match the name of a printer on your system. (In this example the printer name is set to "HP LaserJet". You should change it to match the name of the printer you want used.)
The trick is to create one of these macros for each of the printers you use. You can then modify a toolbar so that each printer has its own print button. When you then click on the command or button, the appropriate macro is run and you get output on the desired printer.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2217) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Working with Multiple Printers.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
If you need to modify where a worksheet is printed (meaning, which paper tray it should use), Excel doesn't provide a lot ...
Discover MoreWould you like to have a worksheet automatically printed when a particular cell contains a specified value? You can ...
Discover MoreNeed to have your print settings always be a certain way? Tired of resetting the settings after others use the workbook ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2019-05-23 10:26:10
Sean Hayes
Hi,
This is probably the solution that I have been looking for.
The problem I have is that my spreadsheet asks the user in a pop up dialogue box how many copies they require. This would make the last line of this obsolete and I'm not sure on how I would incorporate it into the vba I already have.
The code i already have is :-
Sub PrintCurrentSheet(ByVal pFound As Range)
Select Case MsgBox("Print Supply & Fit or Supply Only?" & vbCrLf & "Please select Yes for Supply & Fit, or No for Supply Only", vbYesNo)
Case vbYes
Sheets("Labels").Select
Case vbNo
Sheets("Unbranded Labels").Select
End Select
Range("E1,O1,E22,O22") = pFound
Range("A10,J10,A31,J31") = pFound.Offset(0, IIf(rOnly, -8, -4))
Range("C10,M10,C31,M31") = pFound.Offset(0, IIf(rOnly, -7, -3))
Range("G10,Q10,G31,Q31") = pFound.Offset(0, IIf(rOnly, -6, -2))
Call ToggleOn
'ASKS HOW MANY COPIES TO PRINT
Do
NumberofCopies = Application.InputBox("How many copies do you want to print? Must enter 0-50", Type:=1)
If NumberofCopies = 0 Then ' If user clicks on Cancel button
Call ToggleOff
Exit Sub
End If
If NumberofCopies > 50 Then MsgBox "Max to print is 50 copies" Else Exit Do
Loop
ActiveSheet.PrintOut Copies:=NumberofCopies
Call ToggleOff
Sheets("Scan").Select
End Sub
2018-02-20 02:42:45
Syed M Husain
Sub GoodPrinter()
Application.ActivePrinter = "HP LaserJet"
ActiveWindow.SelectedSheets.PrintOut Copies:=1
End Sub
This macro does not work for excel 2003. It stops at Application.ActivePrinter = "Printer name"
2018-02-02 18:36:26
Mike
I don't know what I'm doing wrong but I tried to ceate a macro using your example and changing out the printer name and when I try to run it nothing happens. No error message but also no output to the printer. Can you give me any ideas what might be wrong with my macro? I am using Excel 2010. The file is stored on a network share but I have both enabled the macros and trusted the document. Thanks.
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments