title: VBA Excel SelectSingleNode syntax
body: <p>I'm using the following code to get the value of the "DistanceUnit" element in my xml:</p>
  
  <pre><code>Dim xmlDoc As MSXML2.DOMDocument60
  Dim xmlElement As MSXML2.IXMLDOMElement
  
  Set xmlDoc = New MSXML2.DOMDocument60
  xmlDoc.async = False
  xmlDoc.validateOnParse = False
  
  xmlDoc.LoadXML strResponse
  Set xmlElement = xmlDoc.DocumentElement
  
  Set curNode = xmlElement.SelectSingleNode("/Response/ResourceSets/ResourceSet/Resources/Route/DistanceUnit")
  </code></pre>
  
  <p>When debugging I see that curNode is NOTHING. I don't understand why.
  When I use an itterative code it seems to work ok:</p>
  
  <pre><code>Set xmlRoot = xmlDoc.DocumentElement
  Set xmlChildren = xmlRoot.ChildNodes
  
  For Each xmlTemplate In xmlChildren
      If xmlTemplate.nodeName = "ResourceSets" Then
          MsgBox "found!"
          Exit For
      End If
  Next xmlTemplate
  </code></pre>
  
  <p>I don't want to use itterative code, since I know the exact xpath to the element...</p>
  
  <p>This code work as well, but I just want to use the xpath:</p>
  
  <pre><code>Set curNode = xmlRoot.ChildNodes(6).ChildNodes(0).ChildNodes(1).ChildNodes(0).ChildNodes(2)
  MsgBox curNode.Text
  </code></pre>
  
  <p>Thanks,
  Li</p>
  
  <p>My xml:</p>
  
  <pre><code>&lt;Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"&gt;
      ....
      &lt;StatusCode&gt;200&lt;/StatusCode&gt;
      &lt;StatusDescription&gt;OK&lt;/StatusDescription&gt;
      &lt;AuthenticationResultCode&gt;ValidCredentials&lt;/AuthenticationResultCode&gt;
      &lt;ResourceSets&gt;
          &lt;ResourceSet&gt;
              &lt;EstimatedTotal&gt;1&lt;/EstimatedTotal&gt;
              &lt;Resources&gt;
                  &lt;Route&gt;
                      .....
                      &lt;DistanceUnit&gt;Kilometer&lt;/DistanceUnit&gt;
                      .....
                  &lt;/Route&gt;
              &lt;/Resources&gt;
          &lt;/ResourceSet&gt;
      &lt;/ResourceSets&gt;
  &lt;/Response&gt;
  </code></pre>