vba code to export Excel sheet as Adobe pdf of highest quality

DougRobertson

Active Member
Joined
Sep 22, 2009
Messages
334
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have been using the "Selection.ExportAsFixedFormat Type:=xlTypePDF" option for exporting Excel files to PDFs, but the quality is not very good.

Is there a way using VBA to have the Excel file exported or saved as an Adobe PDF with high quality?

Thank you in advance for your insight and help - as always!

~ DWR
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi,

Text and numbers in PDF are based on used Font and should not become lower in quality.
To improve quality of images provide the following settings before the first saving of a workbook:
File - Options – Advanced – section 'Image Size and Quality'
– choose 'Set default target output to': 220 ppi
– select the 'Do not compress Image in file'
- OK

Regards
 
Last edited:
Upvote 0
Hi ZVI,

Thank you for taking a look at this for me. Great instructions, but it doesn't change the look or resolution at all.

I set the Default resolution to "High fidelity" and have ticked the "Do not compress images in file" box, and then saved the Excel file, but it makes no difference.

Am I still missing something?

Here's the pertinent code I'm using:

Code:
    Workbooks("CHAB  Moose Jaw, SK  -  FOCUS  -  PROGRAM  CCN  -  2017.xlsx").Sheets(1).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        iSDSFolder & _
            "TEST.pdf", _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=True
 
Upvote 0
Your code is good.

But have you set this option: Set default target output to: 220 ppi ?
It's critical to resolution of images in PDF.
And of course, the re-inserting images should be made in case their resolution in Excel was decreased previously by low level of that setting.

Could you please confirm that problems concern to images only?
 
Upvote 0
I tried the "Default resolution" at 220 ppi, and also at "High fidelity", but it didn't make any difference.

It's more the Fonts that look quite fuzzy - low resolution, and not the images.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

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