I would like to extract the duration/text and distance/text values from this XML but the code found is using is not returning those values
Dim domResponse As DOMDocument60 Set domResponse = New DOMDocument60 domResponse.loadXML objXMLHTTP.responseText Dim ixnStatus As Variant Set ixnStatus = domResponse.selectSingleNode("//status") If ixnStatus.Text = "OK" Then Dim ixnDistance, ixnDuration Set ixnDistance = domResponse.selectSingleNode("/DistanceMatrixResponse/row/element/distance/text")Debug.Print ixnDistance Set ixnDuration = domResponse.selectSingleNode("/DistanceMatrixResponse/row/element/duration/text")Debug.Print ixnDuration End If
and actually raises an error (#438 Object doesn't support this property or method) on line 11
I'm sure this is just a matter of getting the "SelectSingleNode" argument correct, but I have played with just about every combination of nodes names and cannot get this right.
Debug.Print ixnDistance
try this instead:
Open in new window