用vba把excel文件發布轉化為pdf格式文件
阿新 • • 發佈:2018-09-10
asf style orm microsoft end ksh ext his 文件
將工作薄每一個工作表導出為PDF文件。
Sub aliensky() Dim asy As Worksheet Dim spath As String spath = Excel.ThisWorkbook.Path For Each asy In Excel.ThisWorkbook.Worksheets sName = spath & "\" & asy.Name & ".pdf" asy.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sName Next End Sub
將當前工作表導出為PDF文件。
Sub aliensky1() spatch = Excel.ThisWorkbook.Path sName = spatch & "\" & ActiveWorkbook.Name & ".pdf" ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sName End Sub
VBA 參考文檔
https://msdn.microsoft.com/zh-cn/VBA/Excel-VBA/articles/workbook-exportasfixedformat-method-excel
用vba把excel文件發布轉化為pdf格式文件