WORD转PDF脚本文件

1、在桌面新建一个文本文件,把下列代码复制到文本文件中。

bash 复制代码
On Error Resume Next
Const wdExportFormatPDF = 17
Set oWord = WScript.CreateObject("Word.Application")
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set fds=fso.GetFolder(".")
Set ffs=fds.Files
For Each ff In ffs
    If (LCase(Right(ff.Name,4))=".doc" Or LCase(Right(ff.Name,4))="docx" ) And Left(ff.Name,1)<>"~" Then
        Set oDoc=oWord.Documents.Open(ff.Path)
        odoc.ExportAsFixedFormat Left(ff.Path,InStrRev(ff.Path,"."))&"pdf",wdExportFormatPDF
        If Err.Number Then
        MsgBox Err.Description
        End If
    End If
Next
odoc.Close
oword.Quit
Set oDoc=Nothing
Set oWord =Nothing
MsgBox "ALL Word files have been converted to PDF format!"

2、然后将文件名改为ConvertWordToPdf.vbs即可。

相关推荐
百事牛科技11 天前
保护文档安全:PDF限制功能详解与实操
windows·pdf
开开心心就好11 天前
安卓开源应用,超时提醒紧急人护独居安全
windows·决策树·计算机视觉·pdf·计算机外设·excel·动态规划
骆驼爱记录12 天前
WPS页码设置:第X页共Y-1页
自动化·word·excel·wps·新人首发
2301_8169978812 天前
Word 清除格式的方法
word
微光feng12 天前
毕业论文word引用操作汇总
word·目录·公式·毕业论文·交叉引用·题注
2301_8169978812 天前
Word 功能区与快速访问工具栏
word
halen33312 天前
Hellowordl: The Masters Tool for Word Puzzle Enthusiasts
word
lpfasd12312 天前
Markdown 导出 Word 文档技术方案
开发语言·c#·word
Cxiaomu12 天前
Python 文件解析: Excel / Word / PDF 的解析、处理、预览与下载
python·word·excel
Felicia-侧听12 天前
如何统一PDF页面宽度?统一pdf宽度的2种方法
pdf·pdf宽度统一