excel利用VBA 在保存文档时,生成pdf文件

Private Sub Workbook_AfterSave(ByVal Success As Boolean)

Dim fso
Dim f
Dim readText As String
filepath = "C:\temp\FileName.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(filepath)
readText = f.ReadAll
readText = Replace(readText, vbCrLf, "")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=readText


End Sub

你可能感兴趣的:(SAP,excel利用VBA,在保存文档时,生成pdf文件)