编写一个word2htm.vbs,然后把它拖放到存放word文档内,点按两下word2htm.vbs,目录内的所有文档会自动转换成htm文件。 word2htm.vbs的编码如下。 Set fsObject = CreateObject ("Scripting.FileSystemObject") myDocDir=fsObject.GetAbsolutePathName("") If InStrRev(myDocDir, "\") < Len(myDocDir) Then myDocDir = myDocDir & "\" End If Set DocFilesDir = fsObject.Getfolder(myDocDir) Set myDocFiles = DocFilesDir.Files Set myObject = Wscript.CreateObject("Word.Application") n = 0 For Each DocFile In myDocFiles If LCase(Right(DocFile.Name, 3)) = "doc" Then HTMLFileName = myDocDir & Left(DocFile.Name,InStrRev (DocFile.Name, ".")) & "htm" myObject.Documents.Open DocFile.Path,,,,,,,,,,,False myObject.Documents(DocFile.Path).Activate myObject.ActiveDocument.SaveAs HTMLFileName,10,False,,True,,False,False,False,False,False myObject.ActiveDocument.Close n = n + 1 End If Next If n > 0 Then MsgBox n & " file(s) converted!" Else MsgBox "No file converted." End If myObject.Quit Set myObject = Nothing |