> 文章列表 > word转pdf的软件(word文档批量转pdf)

word转pdf的软件(word文档批量转pdf)

word转pdf的软件(word文档批量转pdf)

word批量转pdf

今天分享2种word批量转pdf的方法。

一、使用word自带vba实现

有些公司规定电脑不允许联网、不能随意安装软件。有时批量打印word文档时容易格式混乱,就需要转换成pdf再打印。

具体实现方式:

1、 在桌面随意新建一个doc文档,然后打开后同时按alt和F11,双击下图方框。

word转pdf的软件(word文档批量转pdf)

2、 将代码复制后。(代码放在本文末尾)

word转pdf的软件(word文档批量转pdf)

3、 按F5运行代码,选择pdf要保存的位置,需要转换的word(word文件可多选),等待转换成功。

我已经提前把带有宏程序的word文件准备好了。直接打开文件按下按钮即可直接运行宏程序。

宏程序演示:

word转pdf的软件(word文档批量转pdf)

宏程序下载:

链接:https://pan.baidu.com/s/1qKQ3cEFmZAMr5yRG-NZWCQ

提取码:dnjf

二、在线网站转换

当然这种方式适合一些不重要的word文档,毕竟一旦上传到网络就可以视作文档已经泄露,对于一些包含商业秘密或者隐私性较强的文档不建议这种方式。

网站:https://convertio.co/

将多个word文档上传后,选择格式为pdf即可转换。下图为转换完成的图片,转换后需再下载至本地。

word转pdf的软件(word文档批量转pdf)


代码如下:

Sub BatchConvertToPDF()Dim destFolderPath As StringdestFolderPath = GetFolderPathIf destFolderPath  Empty ThenDim path As VariantFor Each path In GetFilePaths()Dim indexOfSlash, indexOfDot As IntegerindexOfSlash = InStrRev(path, \"\\\")indexOfDot = InStrRev(path, \".\") Dim destFilePath As StringdestFilePath = destFolderPath Mid(path, indexOfSlash, indexOfDot - indexOfSlash) \".pdf\" ConvertToPDF path, destFilePathNext pathEnd IfEnd Sub Function GetFilePaths()Dim folderPath As StringWith Application.FileDialog(msoFileDialogFilePicker).Filters.Add \"word文件\", \"*.doc; *.dotx; *.docm\".Title = \"请择要转换的word文件\"If .Show = -1 ThenSet GetFilePaths = .SelectedItemsEnd IfEnd WithEnd Function Function GetFolderPath()Dim folderPath As StringWith Application.FileDialog(msoFileDialogFolderPicker).AllowMultiSelect = False.Title = \"请选择要存放的目录\"If .Show = -1 ThenGetFolderPath = .SelectedItems(1)End IfEnd WithEnd Function Sub ConvertToPDF(srcPath As Variant, destPath As String)Documents.Open FileName:=srcPath, ConfirmConversions:=False, _ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:=\"\", _PasswordTemplate:=\"\", Revert:=False, WritePasswordDocument:=\"\", _WritePasswordTemplate:=\"\", Format:=wdOpenFormatAuto, XMLTransform:=\"\"ActiveDocument.ExportAsFixedFormat OutputFileName:= _destPath, ExportFormat:= _wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _wdExportOptimizeForOnScreen, Range:=wdExportAllDocument, From:=1, To:=1, _Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _BitmapMissingFonts:=True, UseISO19005_1:=FalseActiveDocument.CloseEnd Sub