How To Select a printer tray before printing using VBA in Excel?
Tags: toselectaprintertray, vbamacros
Published: 2021-09-30 08:08:46

---
title: How To Select a printer tray before printing using VBA in Excel?
published: true
date: 2021-09-28 10:54:03 UTC
tags: ToSelectAPrinterTray,VBAMacros
canonical_url: https://geekexcel.com/how-to-select-a-printer-tray-before-printing-using-vba-in-excel/
---

In this post, we will explain to you how to  **select a printer tray before printing using VBA** in Excel. Let’s see them below!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## Example

- Firstly, in the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic](https://geekexcel.com/wp-content/uploads/2021/09/Select-Visual-Basic-9-1024x180.png)<figcaption>Select Visual Basic</figcaption>

- Now, you have to  **copy and paste the code**  given below.

```
Sub ChangeTray()
' selects the manual page tray without printing
    Application.SendKeys "%fu%e{TAB}{DOWN}{DOWN}{TAB}m~{ESC}", True
End Sub

Sub ChangeTrayAndPrint()
' selects the manual page tray and prints the selected sheet(s)
    Application.SendKeys "%fu%e{TAB}{DOWN}{DOWN}{TAB}m~~", True
End Sub

```

- You need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-90.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- You need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://geekexcel.com/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Then, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.

![](https://geekexcel.com/wp-content/uploads/2021/09/Run-the-Code-58.png)<figcaption>ChangeTrayAndPrint Run the Code</figcaption>

- Now, you will get the **output** as given below after clicking the **ChangeTrayAndprint Macro**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Output1-6.png)<figcaption>Output 1</figcaption>

- After that, you have to make sure that your  **macro name** is selected and click the  **Run ** button.

![](https://geekexcel.com/wp-content/uploads/2021/09/Run-the-Code-1-1.png)<figcaption>Change Tray Run the Code</figcaption>

- Finally, you will get the **output** as given below after clicking the **ChangeTray Macro**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Output2.png)<figcaption>Output 2</figcaption>

## Conclusion

We hope that this tutorial gives you guidelines on how to  **select a printer tray before printing using VBA** in Excel. Please leave a comment in case of any  **queries,**  and don’t forget to mention your valuable  **suggestions**  as well. Thank you so much for Visiting Our Site!! Continue learning on **[Geek Excel](https://geekexcel.com/)!! **Read more on [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

**Continue Reading:**

- **[Printing a List into Multiple Columns to Fit on Each Printed Page in Excel!!](https://geekexcel.com/printing-a-list-into-multiple-columns-to-fit-on-each-printed-page-in-excel/)**
- **[How to Print Multiple Workbooks/Worksheets from Directories in Excel 365?](https://geekexcel.com/how-to-print-multiple-workbooks-worksheets-from-directories-in-excel-365/)**
- **[Excel Formulas to Find the Same Date in Next Year ~ Simple Guide!!](https://geekexcel.com/excel-formulas-to-find-the-same-date-in-next-year/)**
- **[How to Directly Print Data with Circle Invalid Data in Excel?](https://geekexcel.com/how-to-directly-print-data-with-circle-invalid-data-in-excel/)**
- **[How to Print Pages in Reverse Order in Excel Office 365?](https://geekexcel.com/how-to-print-pages-in-reverse-order-in-excel-office-365/)**