VBA code to print selected columns with 'Microsoft Print to PDF' printer

Rafal1978

New Member
Joined
Dec 27, 2021
Messages
2
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi,
I tried to search for that exact solution but could not find it.
Can you help me with this issue please? I need a fast solution for it.
I do not want to use Export to PDF becasue PDF generated this way looks bad.

The steps I would like to do by clicking a button are:
1. Select a range of columns
2. Select 'File' -> 'Print'
3. Select the printer from the list 'Microsoft Print to PDF'
4. Select 'Print Selection' in the settings
5. Select the 'Landscape orientation' in the settings
6. Click -> Print
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
The solution is:

Columns("A:P").Select
Application.ActivePrinter = "Microsoft Print to PDF na Ne01:"
ActiveSheet.PageSetup.Orientation = xlLandscape
Selection.PrintOut Copies:=1, Collate:=True
 
Upvote 0

Forum statistics

Threads
1,215,334
Messages
6,124,325
Members
449,154
Latest member
pollardxlsm

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