wrong PDF output size with ExportAsFixedFormat in Excel VBA

前端 未结 4 592
轮回少年
轮回少年 2020-12-17 05:15

I use Excel 2010 with VBA.

I have the following code :

mySh.PageSetup.PaperSize = xlPaperLetter
mySh.ExportAsFixedFormat Type:=xlTypePDF, _
    Filen         


        
4条回答
  •  庸人自扰
    2020-12-17 05:25

    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.

提交回复
热议问题