word批量转PDF 利用word的宏

打开一个world ,操作说明搜索 ->输入 宏 -> 选择 查看宏 -> 创建

1、把下面代码拷贝到编辑器中
2、修改 ChangeFileOpenDirectory "D:\shares\word" '文件夹位置 为自己的文件夹
3、点击上面的启动按钮开始运行
就可以等待自动转换啦~~~

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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容