新建文本文档
输入On Error Resume Next
Const wpsExportPDF = 17
Set wps = CreateObject("KWps.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
Set fds = fso.GetFolder(".")
For Each ff In fds.Files
If (LCase(Right(ff.Name, 4)) = ".doc" Or LCase(Right(ff.Name, 5)) = ".docx") And Left(ff.Name, 1) <> "~" Then
Set doc = wps.Documents.Open(ff.Path)
doc.SaveAs Left(ff.Path, InStrRev(ff.Path, ".")) & "pdf", wpsExportPDF
If Err.Number <> 0 Then
MsgBox "Error exporting " & ff.Name & " to PDF: " & Err.Description
Err.Clear
End If
doc.Close
End If
Next
wps.Quit
Set doc = Nothing
Set wps = Nothing
MsgBox "All done!"
修改后缀为vbs
放置在同一文件夹,双击后,显示all done即为结束