怎么批量打印excel文件成pdf
发布网友
发布时间:2022-04-29 22:55
我来回答
共1个回答
热心网友
时间:2023-10-10 00:20
利用excel的pdf输出功能即可。
参考:
Sub exportPdf(sheetName As String, ByVal pname As String)
Dim pdfPath As String
pdfPath = ThisWorkbook.Path & "\pdf\"
Sheets(sheetName).Activate
If Dir(pdfPath, vbDirectory) = "" Then
MkDir pdfPath
End If
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=pdfPath & pname & "_" & sheetName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub