Function 高德测距(a As String, b As String)
Dim x As MSXML2.XMLHTTP60
Set x = New MSXML2.ServerXMLHTTP60
Dim sc As MSXML2.DOMDocument60
With x
.Open "GET", "https://restapi.amap.com/v3/direction/driving?origin=" & a & "&destination=" & b & "&extensions=all&output=xml&key=<用户的key>", False
'.setRequestHeader
.send
Set sc = .responseXML
'Debug.Print sc.XML
End With
Dim node As MSXML2.IXMLDOMNode
Set node = sc.SelectSingleNode(querystring:="//distance")
’Debug.Print node.Text
高德测距 = node.Text
End Function