title: VBA XML how can I get the Parent attribute from a child node?
body: <p>I have a search screen where you can select different options (items that are child nodes). After hitting search I would like togo through a XML document and retrieve the parent node attribute. For example:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;brands&gt;
    &lt;BrandA Name="A Brand"&gt;
       &lt;Color&gt;Black&lt;/Color&gt;
       &lt;Thickness&gt;1"&lt;/Thickness&gt;
       &lt;Texture&gt;Smooth&lt;/Texture&gt;
    &lt;/BrandA&gt;
    &lt;BrandB Name="B Brand"&gt;
       &lt;Color&gt;Red&lt;/Color&gt;
       &lt;Thickness&gt;2"&lt;/Thickness&gt;
       &lt;Texture&gt;Smooth&lt;/Texture&gt;
    &lt;/BrandB&gt;
    &lt;BrandC Name="C Brand"&gt;
       &lt;Color&gt;Green&lt;/Color&gt;
       &lt;Thickness&gt;3"&lt;/Thickness&gt;
       &lt;Texture&gt;Rough&lt;/Texture&gt;
    &lt;/BrandC&gt;
  &lt;/brands&gt; 
  </code></pre>
  
  <p>If someone is searching from a "Rough" texture how could I get the parent node of BrandC Name?</p>
  
  <p>VBA CODE:</p>
  
  <pre><code>For Each T In objDom.getElementsByTagName("Texture") 
  
      MsgBox T.Text 'For testing to see what it returns (all 3 textures).
  
  If ComboBox3.Value = T.Text Then
      'For testing: This returns all matching textures that was selected.
      MsgBox T.ParentNode.Text 
  End If
  </code></pre>
  
  <p>So this returns everything Brand name, color, thickness, texture. I just need the Brand Name IE "C Brand". </p>