Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Specifying a Paper Tray in a Macro.

Specifying a Paper Tray in a Macro

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


If you use macros to print your worksheets, you already know that the macro can specify the actual printer to which output should be sent. What if you want to also specify a specific paper tray to be used on that printer? Unfortunately, this gets to be a bit of a sticky wicket. The problem is that when you click on the Options button in the Page Setup dialog box in order to set which paper tray to use, what you see is completely under the control of your printer driver, not under the control of Excel.

What does this mean to you? It means there are no commands you can use in an Excel macro to specify a printer tray. There are some workarounds that you can try, however. The first workaround is to simply define different printer definitions in Windows, each one tailored to use a specific printer tray. Follow these general steps:

  1. Determine how many paper trays you want to use on the printer.
  2. Define a new printer for each paper tray you want to use. For instance, if you want to use three different paper trays, you would define three printers, each with a name representative of a paper tray.
  3. Right-click on a printer definition and change the properties of the printer so it prints to the desired paper tray.
  4. Repeat step 3 for each of the other printer definitions, making sure you specify different paper trays for each one.

At this point you have multiple printer definitions set up, and each will print to a different paper tray on the same printer. Within Excel you can specify the desired printer, in a macro, so that the printout goes to the desired printer definition, and hence to the desired paper tray. The only drawback to this solution, of course, is that it takes quite a bit of setup work. If you work in an office with 50 users, this means you will need to make sure all 50 have each printer defined as described above.

Another workaround involves the use of the SendKeys statement in your macro. You can find information on SendKeys in the VBA online help available with Excel, but what it basically does is to stuff the keyboard buffer with a series of keypresses, just as they would be typed by the user. Thus, you could theoretically set up the macro to emulate the keypresses you would follow to open the Page Setup dialog box, click on Options, and select a different printer tray.

There is a potential problem with SendKeys, however, and it is a big one. It can be unreliable because there is no way to ensure that the keystrokes are actually going where you want. On a multi-threaded operating system (like Windows), some other process could intervene and derail the commands. In addition, if SendKeys works on your computer, it may not work on someone else's computer unless they have the same version of Excel, same printer, and same printer driver version.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7010) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Specifying a Paper Tray in a Macro.

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

Creating Custom Labels

There is a whole passel of labels pre-defined in Word. You are not limited to this passel, however; Word allows you to ...

Discover More

ExcelTips: Times and Dates

Excel is great at storing all types of data, including times and dates. ExcelTips: Times and Dates provides the ...

Discover More

Shortening ZIP Codes

US ZIP Codes can be of two varieties: five-digits or nine-digits. Here's how to convert longer ZIP Codes to the shorter ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Executing a Macro After Printing is Done

You can modify Excel's BeforePrint event handler to change how the printing process occurs. Unfortunately, though, Excel ...

Discover More

Changing Paper Size for a Complete Workbook

If you need to change the size of paper on which your worksheets will be printed, it can be bothersome to make the change ...

Discover More

Can Only Print to Default Printer

It is helpful to be able to print out worksheets when you need to share them with others. It is even more helpful if you ...

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 8 - 5?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.