Written by Allen Wyatt (last updated December 6, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021
Many of the printers available on the market these days have some amazing capabilities. Most of these capabilities are accessible by displaying the Properties dialog box for the printer. As you are developing your own macros, you may wonder if it is possible to access these capabilities from within the macro.
Unfortunately, it doesn't appear that this can be done because the printer drivers don't typically make the features of printers available in a way that can be understood and accessed from the object model used by VBA. (Boy, was that a mouthful!) Instead, you would have to use the actual Windows API, and even then, not all features may be accessible.
There are some workarounds that can be used, however. You can use VBA to select different printers to which you can direct your output. This means that you can create different printer definitions—in Windows—and then use those definitions as the target for your output.
For example, you could use the Printers folder in Windows to set up a printer named HP Regular Paper. That printer definition can be set to print on regular paper, by default. You can then set up another printer definition named HP Glossy Paper and set it to print, by default, to a tray that may contain glossy paper. With the two printers defined, you can then use VBA to switch between the two. For instance, if you wanted to print to the printer definition for the glossy paper, you could use the following in your macro:
Application.ActivePrinter = "HP Glossy Paper"
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9178) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021. You can find a version of this tip for the older menu interface of Excel here: Controlling the Printer in a Macro.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
Excel allows you to easily print an entire workbook. Doing so, however, may not give the desired results if you a ...
Discover MoreIf you want to save paper on a printout, you might consider printing multiple pages on a single piece of paper. This can ...
Discover MoreHyperlinks can be real handy in a workbook, but you may not always want them visible when you send the workbook to the ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-01-20 18:20:16
Sarah V
How does one go about creating a printer definition for a specific set of presets, as noted above (the HP Regular Paper and HP Glossy)?
Is it something that one does through printer properties, or are you basically adding the same physical printer multiple times, each time setting the preferences to what you want?
Thanks
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments