打開(kāi)一個(gè)world ,操作說(shuō)明搜索 ->輸入 宏 -> 選擇 查看宏 -> 創(chuàng)建
1、把下面代碼拷貝到編輯器中
2、修改ChangeFileOpenDirectory "D:\shares\word" '文件夾位置為自己的文件夾
3、點(diǎn)擊上面的啟動(dòng)按鈕開(kāi)始運(yùn)行
就可以等待自動(dòng)轉(zhuǎn)換啦~~~
Sub word2pdf()
'
' word2pdf 宏
'
'
Dim file As String
ChangeFileOpenDirectory "D:\shares\word" '文件夾位置
file = Dir("*.doc")
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

image.png

image.png

image.png