htm转word格式转换器

来源:百度知道 编辑:UC知道 时间:2024/06/04 00:52:05
我要大批量的htm转成word格式,不想一个一个的改后缀.doc,有没有这样的软件呢?谢谢~

将代码保存为VBS,放到相应的文件夹:

Const wdFormatFilteredHTML = 10
Const wdFormatDocument = 0

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\SH60'} Where " _
& "ResultClass = CIM_DataFile")

Set objWord = CreateObject("Word.Application")

For Each objFile in colFiles
If objFile.Extension = "htm" Then
strFile = "C:\SH60\" & objFile.FileName & "." & objFile.Extension
strNewFile = "C:\DOC\" & objFile.FileName & ".doc"
Set objDoc = objWord.Documents.Open(strFile)
objDoc.SaveAs strNewFile, wdFormatDocument
objDoc.Close
End If
Next

objWord.Qui