Sub word2pdf()
'
' word2pdf 宏
'
'
Dim file As String
ChangeFileOpenDirectory "C:\TEST RENAME" '文件夹位置
file = Dir("*.docx")
Do Until file = ""
Documents.Open FileName:=file
FileName = ActiveDocument.Name
BaseName = Left(FileName, InStrRev(FileName, ".") - 1)
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
BaseName & ".pdf", ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
True, UseISO19005_1:=False
ActiveDocument.Close
file = Dir
Loop
End Sub
vba批量将word转pdf
于 2024-06-19 14:32:15 首次发布