方法:使用Microsoft Word批处理宏
批量实现Word转PDF功能,适合办公人员。无需安装额外软件,操作简单,原生支持。
(1)打开任意 Word 文档,按下 Alt + F11 打开 VBA 编辑器(点击“开发工具”,点击“visual Basic”)

(2)在Project(文档)右键鼠标,点击“插入”,选择“模块”,复制以下代码:
Sub BatchConvertWordToPDF()Dim folderPath As StringDim wordFile As StringDim doc As DocumentfolderPath = InputBox("请输入包含 Word 文件的文件夹路径", "选择文件夹")If folderPath = "" Then Exit Sub wordFile = Dir(folderPath & "\*.docx")Do While wordFile <> ""Set doc = Documents.Open(folderPath & "\" & wordFile)doc.ExportAsFixedFormat OutputFileName:=folderPath & "\" & Replace(wordFile, ".docx", ".pdf"), _ExportFormat:=wdExportFormatPDFdoc.Close FalsewordFile = Dir()LoopMsgBox "批量转换完成!" End Sub
(3)运行脚本,即可将指定文件夹内所有 .docx 批量转为 PDF。
