Excel 2013在VBA中打印到PDF [英] Excel 2013 Print to PDF in VBA
本文介绍了Excel 2013在VBA中打印到PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
非常感谢你们所有
解决方案
尝试
Dim fp As String
Dim wb As Workbook
fp =C:\temp\foo.pdf
设置wb = ActiveWorkbook
wb.ExportAsFixedFormat类型:= xlTypePDF,_
文件名:= fp,_
质量:= xlQualityStandard,_
IncludeDocProperties:= True,_
IgnorePrintAreas:= False,_
OpenAfterPublish:= False
*请注意, ExportAFixedFormat
必须在一行上具有所有变量,否则不会编译。
**请注意,'_'字符应该允许编译,而不是全部在一行
As it seems that Excel 2013 allow for direct Save as to PDF format, how can in perform this using VBA code ? I would like to build a macro that will automatically create a PDF from a worksheet (with the name of the file being passed as String variable). Many thanks to you all
解决方案
Try
Dim fp As String
Dim wb As Workbook
fp = "C:\temp\foo.pdf"
Set wb = ActiveWorkbook
wb.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=fp, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
*Note that ExportAFixedFormat
must have all its variables on one line or it will not compile.
**Note that the '_' characters should allow this to compile whilst not being all on one line
这篇关于Excel 2013在VBA中打印到PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文