wrong PDF output size with ExportAsFixedFormat in Excel VBA

送分小仙女□ 提交于 2019-12-03 16:12:50

I use Excel 2010 and had this problem. I fixed it by changing the printer in Excel's dropdown list on the Print section of the File tab. My default printer is a Konica Minolta copy machine. I changed it to Local Printer (which doesn't actually exist) and it worked! I now have the VBA code returning an 8.5x11 PDF! Now I don't have to use our clunky old laptop with an old Office to get the right size.

Note that picking the Adobe PDF printer did not fix the problem. Just try messing with the different printer choices, or make a fake printer in your computer's Devices and Printers and use that. I hope it works for others with the same issue!

I set the print area where I wanted it: View-Page Break Preview. Then File-Print-Scaling = Fit Sheet on One Page Or File-Print-Page Setup-Fit to: 1 pages wide by 1 tall.

Hope it helps someone.

I also use Excel 2010 and had the same problem. When using ExportAsFixedFormat, the page won't scale. From what I understand, it is the same as using the Save As with file type pdf. This means that you need to need to scale your workbook to fit the page that you require.

If you:

-Open printer settings and select 'No Scaling'

-Page Layout > Print Area > Clear Print Area

-Select View > Page Break View

It will show you the page area. If you scale your worksheet to this it will save to pdf using ExportAsFixedFormat properly.

We had the same problema and soved it changing at devices and printers the default printing options:

-Control Panel->Devices and Printers->Select the printer by clicking once to it.

-Second mouse button->Printer properties->Advanced->Printing defaults->Advanced.

-Choose paper size and click OK.

Why not to change it at excel? Because somthing related to permissions between Excel and the service running spool or...

That default setting makes the macro to export to the paper size correctly.

If it Works for you, is thanks to our IT department, not to me :P

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!