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

相关推荐
沉默的云朵17 分钟前
NET平台下不借助Office实现Word、Powerpoint等文件的解析(一)
word·powerpoint
asdzx673 小时前
在 React 中轻松实现 PDF 转 Word:纯前端 WASM 方案实战
前端·react.js·pdf
Lyn_Li12 小时前
扫描 PDF 歪了怎么办?用 6 种检测方法做本地批量扶正(附开源工具)
python·pdf·ocr·tesseract·开源工具·文档处理·本地处理·扫描件纠偏
忧郁的紫菜19 小时前
基础实现:单篇 Markdown 转 Word
开发语言·c#·word
chushiyunen1 天前
word使用笔记(二)、邮件合并(模板套用)
笔记·word
Mr.Daozhi1 天前
从零构建 AI 学术论文助手(四):PDF.js 实时截图 + Gemini 视觉分析
javascript·人工智能·pdf·canvas·pdf.js·gemini
许彰午2 天前
75_Python自动化办公之Word与PDF
python·自动化·word
Am-Chestnuts2 天前
DeepSeek 表格如何导出 Word/Excel:Markdown 表格、CSV 与 DS随心转方案对比
word·excel
Am-Chestnuts2 天前
AI 公式复制到 Word 乱码怎么办:LaTeX 转 Word 与 DS随心转方案对比
人工智能·word
wenxin77wx3 天前
3步部署OlmOCR:一行命令将PDF转为LLM训练数据
pdf·- olmocr