前言
? ? ? ? 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