前言
VBA将当前的表格存储成PDF文件进行存储
代码
Sub ExportToPDF()Dim FilePath As StringDim FileName As StringDim ExportRange As Range' 设置导出文件路径及名称FilePath = "D:\Users\"FileName = "ExportedPDF"' 设置导出区域范围Set ExportRange = Range("B1:BE38")' 导出区域到 PDF 文件ExportRange.ExportAsFixedFormat Type:=xlTypePDF, _Filename:=FilePath & FileName & ".pdf", Quality:=xlQualityStandard, _IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub