新建文本文档输入On Error Resume NextConst wpsExportPDF 17Set wps CreateObject(KWps.Application)Set fso CreateObject(Scripting.FileSystemObject)Set fds fso.GetFolder(.)For Each ff In fds.FilesIf (LCase(Right(ff.Name, 4)) .doc Or LCase(Right(ff.Name, 5)) .docx) And Left(ff.Name, 1) ~ ThenSet doc wps.Documents.Open(ff.Path)doc.SaveAs Left(ff.Path, InStrRev(ff.Path, .)) pdf, wpsExportPDFIf Err.Number 0 ThenMsgBox Error exporting ff.Name to PDF: Err.DescriptionErr.ClearEnd Ifdoc.CloseEnd IfNextwps.QuitSet doc NothingSet wps NothingMsgBox All done!修改后缀为vbs放置在同一文件夹双击后显示all done即为结束