Printer tray selection in VBA for printing excel sheet

Jici142

New Member
Joined
Jan 19, 2024
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
Hi,

I'm using a template to print label and each sheet need a different label type from Avery. I recently installed a new printer with 5 trays.

Now I want a VBA sub to print the sheet and make sure it is printed from the right tray. I did configured some printer profiles too which auto-select the pre-defined tray.

Thanks for helping.

JC
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
thanks for reference, but it is not clear from this example how could I specify the tray to use...
 
Upvote 0
You add a new Windows printer for Tray 1, with the printer properties specifically set to use Tray 1. Do the same for the other trays, giving each Windows printer a different name.

This part of the code specifies which Windows printer to use:
VBA Code:
    With ThisWorkbook
        .Worksheets("Sheet1").PrintOut ActivePrinter:=FindPrinter("Brother QL-600"), Copies:=1, IgnorePrintAreas:=False
        .Worksheets("Sheet2").PrintOut ActivePrinter:=FindPrinter("Dymo"), Copies:=1, IgnorePrintAreas:=False
        .Worksheets("Sheet3").PrintOut ActivePrinter:=FindPrinter("Brother L2710"), Copies:=1, IgnorePrintAreas:=False
    End With
Change the printer names according to your printer names.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top