Retrieve values from XML response to Google Maps

I'm pulling data from the Google Map API and it returns an XML response which looks like:
<DistanceMatrixResponse>
 <status>OK</status>
 <origin_address>Grafton, VA 23692, USA</origin_address>
 <destination_address>Yorktown, VA 23690, USA</destination_address>
 <row>
  <element>
   <status>OK</status>
   <duration>
    <value>556</value>
    <text>9 mins</text>
   </duration>
   <distance>
    <value>9779</value>
    <text>9.8 km</text>
   </distance>
  </element>
 </row>
</DistanceMatrixResponse>

Open in new window

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

Open in new window

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.
LVL 51
Dale FyeOwner, Developing Solutions LLCAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCAuthor Commented:
after playing with this for 45 minutes, I posted my question, then stumbled on the proper syntax.

Lines 11 and 13 should have read:

Debug.Print ixnDistance.Text
Debug.Print ixnDuration.Text
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zc2Commented:
I believe, the exception raised, because you trying to print out an object, not a string in
Debug.Print ixnDistance
try this instead:
if ixnDistance is Nothing then
   Debug.Print "No distance node!"
else
   Debug.Print ixnDistance.text
end if

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.