word转换pdf免费版,五个免费转换pdf的软件

首页 > 实用技巧 > 作者:YD1662023-05-01 12:48:33

word批量转pdf

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

一、使用word自带vba实现

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

具体实现方式:

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

word转换pdf免费版,五个免费转换pdf的软件(1)

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

word转换pdf免费版,五个免费转换pdf的软件(2)

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

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

宏程序演示:

word转换pdf免费版,五个免费转换pdf的软件(3)

宏程序下载:

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

提取码:dnjf

二、在线网站转换

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

网站:https://convertio.co/

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

word转换pdf免费版,五个免费转换pdf的软件(4)


代码如下:

Sub BatchConvertToPDF() Dim destFolderPath As String destFolderPath = GetFolderPath If destFolderPath <> Empty Then Dim path As Variant For Each path In GetFilePaths() Dim indexOfSlash, indexOfDot As Integer indexOfSlash = InStrRev(path, "\") indexOfDot = InStrRev(path, ".") Dim destFilePath As String destFilePath = destFolderPath Mid(path, indexOfSlash, indexOfDot - indexOfSlash) ".pdf" ConvertToPDF path, destFilePath Next path End If End Sub Function GetFilePaths() Dim folderPath As String With Application.FileDialog(msoFileDialogFilePicker) .Filters.Add "word文件", "*.doc; *.dotx; *.docm" .Title = "请择要转换的word文件" If .Show = -1 Then Set GetFilePaths = .SelectedItems End If End With End Function Function GetFolderPath() Dim folderPath As String With Application.FileDialog(msoFileDialogFolderPicker) .AllowMultiSelect = False .Title = "请选择要存放的目录" If .Show = -1 Then GetFolderPath = .SelectedItems(1) End If End With End 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:=False ActiveDocument.Close End Sub

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.