我正在寻找以下 VB 的解决方案来批处理 .html 文件/url。我想保存要在 Microsoft Word 中打开的 .html 文件。
这是我正在使用的代码,但我需要它来处理多个 .html 文件:
Option Explicit
'Just change these two lines
Const HTMLFileIn="http://www.example.com"
Const DocFileOut="H:\Word"
Dim MyWord,oIE
Set MyWord=CreateObject("Word.Document")
Set oIE=CreateObject("InternetExplorer.Application")
oIE.Navigate HTMLFileIn
Attend
oIE.document.body.createTextRange.execCommand("Copy")
Attend
MyWord.Content.Paste
MyWord.SaveAs DocFileOut
MyWord.Close
oIE.Quit
Set oIE=Nothing
Set MyWord=Nothing
MsgBox HTMLFileIn & " is now saved as " & DocFileOut
Sub Attend
Wscript.Sleep 500
While oIE.busy
Wscript.Sleep 1000
Wend
While oIE.Document.readyState <> "complete"
Wscript.Sleep 1000
Wend
End Sub