title: Can I update an XML node value using a variable in VBA
body: <p>I am a complete newcomer to learning about XML but OK with VBA in Excel 2010.</p>
  
  <p>In Excel VBA I have created a simple <code>CustomXMLPart</code> with 5 nodes under a single root, akin to the example below:</p>
  
  <pre><code>&lt;
    &lt;RefTest&gt;
        &lt;sRef1&gt;SomeText&lt;/sRef1&gt;    'text
        &lt;sRef2&gt;XYZ234&lt;/sRef2&gt;      'text
        &lt;sRef3&gt;ABC123&lt;/sRef3&gt;      'text
        &lt;dRef4&gt;25/02/1953&lt;/dRef4&gt;  'date or text?
        &lt;iRef5&gt;0&lt;/iRef5&gt;           'numeric or text?
    &lt;/RefTest&gt;
  &gt;
  </code></pre>
  
  <p>This works OK and I can read the values back-in using VBA.</p>
  
  <p>My problem is that the node values (at the moment) are entered as literals (text and digits).</p>
  
  <p>I want to be able to update these node values, from within Excel VBA, but using the contents of VBA variables.</p>
  
  <p>So, for example a user enters a value into a <code>userform</code> text box, into a variable (say <code>MyVar</code>), and I want to update the node value with the contents of this variable.
  A sort of "update node iRef5 with MyVar".
  I can find very little reference to Updating XML values like this, especially using variables, on the web.</p>
  
  <p>Can this be done from within VBA?
  If so, what is the approach, how does XML deal with variables, and perhaps an example of the exact syntax please.</p>
  
  <p>With all thanks in anticipation.</p>