完成此操作所需的数据尚不可用VBA运行时错误

时间:2016-06-27 14:56:03

标签: vba

我从excel vba代码编辑器中收到此运行时错误2147483638。我尝试发送到我的Web服务xml字符串并从Web服务获取响应。似乎错误了,因为响应是""。这是我的代码:

...... 
OutboundDocument.LoadXML (XMLServiceString)
On Error GoTo DoThisAgain
    XMLHTTPClient.Open "POST", WebServiceURL, False
    XMLHTTPClient.Send (OutboundDocument)
   'errors out here

DoThisAgain:
    serviceResponse = XMLHTTPClient.ResponseText ' equals "" gets error

1 个答案:

答案 0 :(得分:0)

这可以避免错误:

Dim MyRequest As MSXML2.XMLHTTP
Set MyRequest = CreateObject("MSXML2.XMLHTTP.6.0")
With MyRequest
    .Open "GET", <URL>
    .send ""
    MyResponse = MyRequest.responseText
End With