我正在尝试执行SOAP调用,但有时响应是数千条记录。我不希望Excel在处理响应时冻结,但我看到的每个示例都需要导入一个带有异步回调的单独文件。有没有方法可以在不使用额外文件的情况下完成此操作?
Public Function SendPost(currentTableAltIden As String, altIdentifiers() As String, Optional aSync As Boolean = True)
Dim t As XMLHTTP60
Dim r As MSXML2.DOMDocument60
Dim nodeList As IXMLDOMNodeList
Dim i As Integer
Dim listLengthControl As Integer
Dim listCounter As Integer
Dim xmlHelper As AsyncHelper
i = 0
Set t = Transport
Set xmlHelper = New AsyncHelper
xmlHelper.init t
t.Open "POST", EndPointUrl, aSync
t.send Text
Set r = New MSXML2.DOMDocument60
r.aSync = False
r.validateOnParse = False
r.SetProperty "SelectionNamespaces", " xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"
r.LoadXML t.responseText
Set nodeList = r.SelectNodes("//result//" & currentTableAltIden)
listLengthControl = nodeList.Length
While listCounter <> listLengthControl
For i = LBound(altIdentifiers) To UBound(altIdentifiers)
Debug.Print r.SelectNodes("//result//" & currentTableAltIden & "//" & altIdentifiers(i))(listCounter).Text
WorkWebServiceTemp.Cells(TableDataRowNum + listCounter, i + 1).value = r.SelectNodes("//result//" & currentTableAltIden & "//" & altIdentifiers(i))(listCounter).Text
Next i
listCounter = listCounter + 1
Wend
End Function
1条答案
按热度按时间mmvthczy1#
只是为了好玩...
cls测试: