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

相关推荐
我命由我12345几秒前
PDFBox - PDFBox 加载 PDF 异常清单(数据为 null、数据为空、数据异常、文件为 null、文件不存在、文件异常)
java·服务器·后端·java-ee·pdf·intellij-idea·intellij idea
道之极万物灭32 分钟前
Python操作word实战
开发语言·python·word
CHANG_THE_WORLD1 天前
PDFium导出pdf 图像
开发语言·c++·pdf
momo_al1 天前
Umi-OCR制作双层PDF
pdf·ocr
励志成为美貌才华为一体的女子1 天前
pdf解析工具---Miner-u 本地部署记录
学习·pdf
reasonsummer1 天前
【办公类-115-02】20251018信息员每周通讯上传之文字稿整理(PDF转docx没有成功)
python·pdf
top_designer1 天前
告别“静态”VI手册:InDesign与AE打造可交互的动态品牌规范
设计模式·pdf·交互·vi·工作流·after effects·indesign
跳动的喵尾巴2 天前
Endnote | word中加载项消失不见,如何处理?
word
夜白宋2 天前
【word多文档docx合并】
java·word
2501_929382652 天前
MobiOffice解锁高级功能版 v15.9.57971 安卓手机doc, docx ppt, .pptx pdf办公软件
智能手机·pdf·powerpoint·wps