Parsing xml string in VBA
<p>I am trying to parse xml document that i am getting from a website.
from some reason i cant figure out i cant parse the value inside the 'RATE' node.
the xml string seems O.K. 
but in the end of the code (commented) i get  Object variable or With block variable not set error.
i will be grateful for any help. </p>

<p><strong>XML STRING:</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt;
&lt;CURRENCIES&gt;
  &lt;LAST_UPDATE&gt;2016-01-25&lt;/LAST_UPDATE&gt;
  &lt;CURRENCY&gt;
    &lt;NAME&gt;Dollar&lt;/NAME&gt;
    &lt;UNIT&gt;1&lt;/UNIT&gt;
    &lt;CURRENCYCODE&gt;USD&lt;/CURRENCYCODE&gt;
    &lt;COUNTRY&gt;USA&lt;/COUNTRY&gt;
    &lt;RATE&gt;3.982&lt;/RATE&gt;
    &lt;CHANGE&gt;0.277&lt;/CHANGE&gt;
  &lt;/CURRENCY&gt;
&lt;/CURRENCIES&gt;
</code></pre>

<p><strong>VBA CODE:</strong></p>

<pre><code>Private Sub loadXMLString(xmlString)

    Dim strXML As String
    Dim xNode As IXMLDOMNode
    Dim XDoc As MSXML2.DOMDocument

    strXML = xmlString

    Set XDoc = New MSXML2.DOMDocument

    If Not XDoc.LoadXML(strXML) Then  'strXML is the string with XML'
        Err.Raise XDoc.parseError.ErrorCode, , XDoc.parseError.reason
    End If

    Set xNode = XDoc.FirstChild

    Debug.Print xNode.SelectSingleNode("RATE").Text ' here i get the Object variable or With block variable not set error
    Debug.Print xNode.ChildNodes(2).SelectSingleNode("RATE").Text ' also with that try i get the Object variable or With block variable not set error

End Sub
</code></pre>

<p><strong>UPDATE:</strong>
i found the problem (as i wrote down in the comments to @Nathan).
the problem is the <code>&lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt;</code> node </p>

<p><strong>Tested it an this code is working:</strong>
so how can i do that with out to remove this node as a substring, there must be a way i guess, but i dont have a lot of experience working with XML</p>

<pre><code>Private Sub loadXMLString(xmlString)

    Dim strXML As String
    Dim xNode As IXMLDOMNode
    Dim XDoc As MSXML2.DOMDocument

    strXML = "&lt;CURRENCIES&gt;" &amp; _
  "&lt;LAST_UPDATE&gt;2016-01-25&lt;/LAST_UPDATE&gt;" &amp; _
  "&lt;CURRENCY&gt;" &amp; _
    "&lt;NAME&gt;Dollar&lt;/NAME&gt;" &amp; _
    "&lt;UNIT&gt;1&lt;/UNIT&gt;" &amp; _
    "&lt;CURRENCYCODE&gt;USD&lt;/CURRENCYCODE&gt;" &amp; _
    "&lt;COUNTRY&gt;USA&lt;/COUNTRY&gt;" &amp; _
    "&lt;RATE&gt;3.982&lt;/RATE&gt;" &amp; _
    "&lt;CHANGE&gt;0.277&lt;/CHANGE&gt;" &amp; _
  "&lt;/CURRENCY&gt;" &amp; _
"&lt;/CURRENCIES&gt;"

    Set XDoc = New MSXML2.DOMDocument

    If Not XDoc.LoadXML(strXML) Then  'strXML is the string with XML'
        Err.Raise XDoc.parseError.ErrorCode, , XDoc.parseError.reason
    End If

    Set xNode = XDoc.FirstChild

    Debug.Print strXML

    Debug.Print xNode.ChildNodes(1).SelectSingleNode("RATE").Text ' also with that try i get the Object variable or With block variable not set error

End Sub
</code></pre>