【发布时间】:2014-08-21 00:45:39
【问题描述】:
我正在尝试在 VBA 中使用 XMLHTTP 对象来检索 HTML 文档并将其插入到 HTMLDocument 对象中以操作元素。但是我的代码出现了自动化错误。我仔细检查了代码,但找不到任何可能的原因。有人可以帮我解决问题吗?
非常感谢!
VBA 代码:
Sub RetrieveData()
Dim strURL As String
Dim strResponse As String
Dim objResponse As Object
Dim objHttpReq As Object
Dim objHTML As New HTMLDocument
strURL = "http://www.customs.go.jp/toukei/srch/indexe.htm?M=57& P=1,1,,,,,,,,,,2013,,9,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,"
Set objHttpReq = CreateObject("MSXML2.XMLHTTP.3.0")
objHttpReq.Open "GET", strURL, False
objHttpReq.send
strResponse = objHttpReq.responseText
objHTML.body.innerHTML = strResponse
MsgBox objHTML.body.innerHTML
End Sub
【问题讨论】:
标签: vba xmlhttprequest