Can Only Print to Default Printer

Written by Allen Wyatt (last updated August 19, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

On Bob's system, Excel refuses to print to any printer other than the one set as the default for the system. This only happens in Excel, not in Word or any other installed application. So in order to print he has to temporarily change the default printer to the one he wants, print, and then remember to set the printer back afterwards. Bob is wondering why he can't choose other printers.

There could be a number of different causes for this problem. One subscriber reported that they had the same problem but that it only cropped up after migrating their office to Windows 7 64-bit and using Windows PrintServer. In their case, they discovered that their was a hidden attribute on the printer queues which caused the problem and they could only get it taken care of by talking with Microsoft support.

Others reported the problem occurring when particular add-ins were installed on the system. (One in particular, Microsoft Office Labs Search Command, was mentioned a few times.) Disabling the add-in solved the problem.

There is a mention of the problem and various fixes here (make sure you click on the Replies drop-down to see the different fixes):

https://answers.microsoft.com/en-us/msoffice/forum/all/excel-2010-only-prints-to-the-default-printer/5b6beddd-f85d-4fda-ab2b-56c750f2028c

You'll want to ensure that this is entered in your browser as a single URL; it is quite long.

If none of the suggested solutions work in your situation, you can try printing via macros. Why? Because you can easily modify the designated default printer in the macro and then change it back. It's all done through the use of the ActivePrinter property. You can determine the name of the current default printer and assign it to a variable, change the printer, then do your printing, and finally change the printer back:

Dim sDefault As String
sDefault = Application.ActivePrinter  'save current default printer
Application.ActivePrinter = "XYZ SuperPrinter"
' do your printing
Application.ActivePrinter = sDefault  'restore default

The only thing you need to do is to make sure that you replace "XYZ SuperPrinter" with the actual name of the printer you want to use. You can find out the name of the printer by making it the default (in Windows) and then, within the VBE Immediate window, printing the name of the printer:

? Application.ActivePrinter

Mark down the name, paying attention to spacing and capitalization, and that is the name you can use in the printing macro.

If this still doesn't work for your needs, then you need to be aware that Microsoft has changed, in the most recent versions of Excel, how the .ActivePrinter property is correctly set. See the following ExcelTip for additional information:

https://tips.net/T13896

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12497) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Turning Off Background Repagination

When you use Word, it normally performs several tasks in the background while you are typing. One of those tasks is to ...

Discover More

Replacing an X with a Check Mark

In order to provide a finishing touch to your document, you may want to replace mundane X marks with fancier check marks. ...

Discover More

Ctrl+V No Longer Works

One of the most commonly used keyboard shortcuts is CTRL+V, which is used to paste the contents of the Clipboard. If ...

Discover More

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!

More ExcelTips (ribbon)

Conditional Printing

If you need to make what Excel prints be based upon conditions in a worksheet, you'll love the information in this tip. ...

Discover More

Selecting a Paper Size

Excel can print your worksheet on just about any paper size you can imagine. How you select the paper size you want used ...

Discover More

Printing a Short Selection

Need to print just a portion of a worksheet? It's easy to do if you follow the steps in this tip.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 5?

2023-08-29 16:10:44

J. Woolley

The Tip says "you can easily modify the designated default printer" and provides a macro for that purpose; however, the Tip's macro changes the active printer, not the default printer. Excel's active printer can easily be changed using its Print dialog (Ctrl+P) without a macro.
The following macro will create and run a VBScript to toggle the default printer:

Sub ToggleDefaultPrinter()
    Const sNewDef = "Microsoft Print to PDF", sNewOnNe = "Ne03:"
    Const sMyName = "ToggleDefaultPrinter"
    Const Q = """", QQ = Q & Q, NL = vbNewLine, BL = NL & NL
    Dim oShell As Object
    Dim sLocale As String, sDefPrn As String, sPrnMgr As String
    Dim sSetDef As String, sCmdOne As String, sCmdTwo As String
    Dim sMsg As String, sScript As String, sPath As String
    Set oShell = CreateObject("WScript.Shell")
    sLocale = oShell.RegRead("HKCU\Control Panel\International\LocaleName")
    sDefPrn = oShell.RegRead("HKCU\Software\Microsoft\Windows NT\" _
        & "CurrentVersion\Windows\Device")
    sDefPrn = Trim(Split(sDefPrn, ",")(0))
    sPrnMgr = "%windir%\System32\Printing_Admin_Scripts\" & sLocale _
        & "\prnmngr.vbs"
    sSetDef = "cscript.exe " & sPrnMgr & " -t -p "
    sCmdOne = "cmd.exe /c " & sSetDef & QQ & sNewDef & QQ
    sCmdTwo = "cmd.exe /c " & sSetDef & QQ & sDefPrn & QQ
    'be careful with the following quotation marks
    sMsg = """The new default printer is"" & NL & """ & sNewDef _
        & """ & BL & ""Click OK to restore the old default"" & NL & """ _
        & sDefPrn & """"
    'avoid changes to the following VBScript
    sScript = "NL = vbNewLine: BL = NL & NL" & NL _
        & "Set oShell = CreateObject(""WScript.Shell"")" & NL _
        & "oShell.Run " & Q & sCmdOne & Q & ", 0, True" & NL _
        & "nButton = oShell.Popup(" & sMsg & ", , " & Q & sMyName & Q _
        & ", (1+64+4096))" & NL _
        & "If nButton = 1 Then oShell.Run " & Q & sCmdTwo & Q & ", 0, True"
    sPath = Environ("Temp") & "\~" & sMyName & ".vbs"
    Open sPath For Output Lock Write As #1: Print #1, sScript: Close #1
    oShell.Run "WScript.exe " & Q & sPath & Q, 0, False
    'do not Kill sPath
    Set oShell = Nothing
    Application.ActivePrinter = sNewDef & " on " & sNewOnNe
End Sub

Update Const sNewDef and sNewOnNe with the name and "Ne-port" for your new default printer. If you have a Print Server, you might need to modify the value of sSetDef in the macro; see https://ss64.com/nt/prnmngr.html
When you run ToggleDefaultPrinter, the old default printer will be changed to sNewDef followed by a Popup similar to the screenshot (see Figure 1 below) and Excel's active printer will be changed accordingly. The Popup will persist until it is dismissed; in the meantime you can print to the new active (default) printer with Excel in the usual way. Finally, click the Popup's OK button to restore the old default printer, or Cancel to retain the new one; Excel's active printer will not change, however.
The Tip references https://tips.net/T13896 for discussion about a printer's "Ne-port" and how to set Application.ActivePrinter. See my comment there regarding the ListPrinters function in My Excel Toolbox, which also includes the following function to return the value of Application.ActivePrinter:
=NameOf("printer")
The NameOf function is described in my comment at https://excelribbon.tips.net/T013432
See https://sites.google.com/view/MyExcelToolbox

Figure 1. 


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.