WebBrowser1控件必须打开一个页面,空白也可以,然后在下列事件处理
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim doc As HTMLDocument
Dim js As HTMLScriptElement
Set js = doc.createElement("script")
js.defer = True
js.src = "http://localhost/a.js"
doc.body.appendChild js
End Sub