Excel中的ExportAsFixedFormat错误的PDF输出大小 [英] wrong PDF output size with ExportAsFixedFormat in Excel VBA
问题描述
我有以下代码:
mySh.PageSetup.PaperSize = xlPaperLetter
mySh.ExportAsFixedFormat类型:= xlTypePDF,_
文件名:= filePathTmp,_
质量:= xlQualityStandard,IncludeDocProperties:= False,_
IgnorePrintAreas:= False,OpenAfterPublish:= False
它生成PDF而不会错误,大小不正确。
我得到一个22.26 x 28.80厘米,而不是我想要获得的21.59 x 27.94厘米。
任何想法?
感谢您的帮助
我使用Excel 2010并遇到此问题。我通过在文件选项卡的打印部分的Excel的下拉列表中更改打印机来修复它。我的默认打印机是柯尼卡美能达复印机。我将其更改为本地打印机(实际上并不存在),它工作!我现在有VBA代码返回一个8.5x11 PDF!现在,我不必使用我们笨重的旧笔记本电脑和旧办公室来获得正确的大小。
请注意,选择Adobe PDF打印机没有解决问题。只需尝试弄乱不同的打印机选择,或在计算机的设备和打印机中制作假打印机,并使用它。我希望它适用于同样问题的其他人!
I use Excel 2010 with VBA.
I have the following code :
mySh.PageSetup.PaperSize = xlPaperLetter
mySh.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=filePathTmp, _
Quality:=xlQualityStandard, IncludeDocProperties:=False, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
It generates a PDF without error but the size is not correct. I get a 22.26 x 28.80 cm instead of the 21.59 x 27.94 cm that I would like to obtain.
Any ideas ?
Thanks for your help
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!
这篇关于Excel中的ExportAsFixedFormat错误的PDF输出大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!