title: CustomXML extraction using VBA in Word
body: <p>I have some CustomXML data in a Word document that I'm trying to reference in VBA.  I have got as far as loading the XML part, but can't get the specific value out.</p>
  
  <p>XML:</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
  &lt;?mso-infoPathSolution solutionVersion="1.0.0.3" productVersion="14.0.0" PIVersion="1.0.0.0" href="http://portal-mysites/personal/adamh/Personal%20Documents/PropTest.xsn" name="urn:schemas-microsoft-com:office:infopath:PropTest:-myXSD-2013-07-01T14-47-53" ?&gt;
      &lt;?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?&gt;
      &lt;my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-07-01T14:47:53"&gt;
        &lt;my:tCompany&gt;AnyCharity&lt;/my:tCompany&gt;
        &lt;my:tCharity&gt;true&lt;/my:tCharity&gt;
        &lt;my:tEthernet&gt;false&lt;/my:tEthernet&gt;
        &lt;my:tContact&gt;ANOther&lt;/my:tContact&gt;
      &lt;/my:myFields&gt;
  </code></pre>
  
  <p>Macro code:</p>
  
  <pre><code> Sub TestPropMac()
      Dim myPart As CustomXMLPart
      Dim oNode As CustomXMLNode
      Set myPart = GetXMLPartByRoot_Element(ActiveDocument, "myFields")
      MsgBox myPart.XML
      Set oNode = myPart.SelectSingleNode("myFields/tCharity")
      MsgBox oNode.NodeValueEnd Sub
  </code></pre>
  
  <p>I'm using MsgBox to confirm I've reached the data (which I haven't) - I intend to use an If statement against the value for another function.</p>