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即可。

相关推荐
非凡ghost3 分钟前
FlexiPDF(专业PDF编辑软件)
windows·学习·pdf·软件需求
xinyu_Jina1 小时前
PaperStudio:WYSIWYG文档的Web实现——从CSS Print到客户端PDF生成的技术解析
前端·css·pdf
2501_9071368220 小时前
PDF Splitter Pro - PDF页面分割器
pdf·软件需求
wangbing112521 小时前
将swagger在线文档转为word
microsoft·c#·word
2023框框2 天前
给PDF书籍添加书签
pdf
kiki-bf2 天前
使用python把图片转为word
开发语言·python·word
月屯2 天前
Pandoc 之--pdf-engine
java·开发语言·pdf
开开心心_Every2 天前
Word转PDF工具,免费生成图片型文档
网络·笔记·pdf·word·powerpoint·excel·azure
dlhto2 天前
Markdown转Word操作指南
linux·centos·word
一个无名的炼丹师2 天前
[硬核实战] 解锁多模态RAG:构建能“看懂”PDF复杂图表的智能问答系统
人工智能·python·pdf·多模态·rag