VBA for Print to PDF custom page size

gli

Board Regular
Joined
Jun 8, 2006
Messages
96
Hello all. I have a file that I would like to print to PDF that would always print only one page wide but print to the length I select with "Set print area" without extraneous white areas on the sides. I have a picture file embedded in the background with a custom header. This picture file is one page wide, but it is long enough to accommodate increases in spreadsheet length as necessary. The problem I am having is that when the file prints to PDF it is shrinking the page down to fit to the paper size I'm forced to choose, and that is leaving me with a bunch of unwanted white space on the sides. I don't have Acrobat to be able to crop the white space out, and other workarounds I've tried have negatively impacted the visual quality of the PDF file (ie, they get blurry). The problem to me seems to stem from the fact that I can't set a custom page size and that my length is dynamic and will always vary from print to print. I am looking for VBA that will enable me to end up with a PDF file that is always one page wide with no white space at the length specified with my print area. Any help would be appreciated!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

mlcalves

New Member
Joined
Mar 10, 2021
Messages
36
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
Hello all. I have a file that I would like to print to PDF that would always print only one page wide but print to the length I select with "Set print area" without extraneous white areas on the sides. I have a picture file embedded in the background with a custom header. This picture file is one page wide, but it is long enough to accommodate increases in spreadsheet length as necessary. The problem I am having is that when the file prints to PDF it is shrinking the page down to fit to the paper size I'm forced to choose, and that is leaving me with a bunch of unwanted white space on the sides. I don't have Acrobat to be able to crop the white space out, and other workarounds I've tried have negatively impacted the visual quality of the PDF file (ie, they get blurry). The problem to me seems to stem from the fact that I can't set a custom page size and that my length is dynamic and will always vary from print to print. I am looking for VBA that will enable me to end up with a PDF file that is always one page wide with no white space at the length specified with my print area. Any help would be appreciated!
Check if this help
 

Forum statistics

Threads
1,144,417
Messages
5,724,195
Members
422,542
Latest member
Seema Tirkey

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
Top