title: extract xml information using vba
body: <p>I am trying to extract 2 bits of information from the following xml file using VBA but they seem really buried and can't seem to access them, I am very new to xml so this is a bit beyond me. I have found a number of examples on the web that I can make work using a simple xml file, but not this.</p>
  <p>On the xml below I have tagged the two bits of information I need to pull out into a spreadsheet - the first one I need will form the header to a column, and then the second piece might occour a number of times below.</p>
  <pre><code>Sub ReadXML()
  Call fnReadXMLByTags
  End Sub
  </code></pre>
  <pre><code>Function fnReadXMLByTags()
  Dim mainWorkBook As Workbook
  Set mainWorkBook = ActiveWorkbook
  mainWorkBook.Sheets(&quot;Sheet1&quot;).Range(&quot;A:A&quot;).Clear
  Set oXMLFile = CreateObject(&quot;Microsoft.XMLDOM&quot;)
  XMLFileName = &quot;C:\Users\xxx\Documents\TestFile.xml&quot;
  oXMLFile.Load (XMLFileName)
  
  Set slotNodes = oXMLFile.SelectNodes(&quot;/instrument/member/list/obj/member/string&quot;)
      
  End Function
  </code></pre>
  <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;
  &lt;instrument&gt;
     &lt;string name=&quot;name&quot; value=&quot;TEST&quot; wide=&quot;true&quot;/&gt;   &lt;!--I NEED TO EXTRACT THIS FIRST--&gt;
     &lt;member name=&quot;slotvisuals&quot;&gt;
        &lt;int name=&quot;ownership&quot; value=&quot;1&quot;/&gt;
        &lt;list name=&quot;obj&quot; type=&quot;obj&quot;&gt;
           &lt;obj class=&quot;USlotVisuals&quot; ID=&quot;882527840&quot;&gt;
              &lt;int name=&quot;displaytype&quot; value=&quot;1&quot;/&gt;
              &lt;int name=&quot;articulationtype&quot; value=&quot;0&quot;/&gt;
              &lt;int name=&quot;symbol&quot; value=&quot;73&quot;/&gt;
              &lt;string name=&quot;text&quot; value=&quot;CUSTOM ART1&quot; wide=&quot;true&quot;/&gt;
              &lt;string name=&quot;description&quot; value=&quot;CUSTOM ART1 DESCRIPTION&quot; wide=&quot;true&quot;/&gt;
              &lt;int name=&quot;group&quot; value=&quot;0&quot;/&gt;
           &lt;/obj&gt;
           &lt;obj class=&quot;USlotVisuals&quot; ID=&quot;45186017184&quot;&gt;
              &lt;int name=&quot;displaytype&quot; value=&quot;1&quot;/&gt;
              &lt;int name=&quot;articulationtype&quot; value=&quot;0&quot;/&gt;
              &lt;int name=&quot;symbol&quot; value=&quot;73&quot;/&gt;
              &lt;string name=&quot;text&quot; value=&quot;GROUP 2&quot; wide=&quot;true&quot;/&gt;
              &lt;string name=&quot;description&quot; value=&quot;GROUP 2&quot; wide=&quot;true&quot;/&gt;
              &lt;int name=&quot;group&quot; value=&quot;1&quot;/&gt;
           &lt;/obj&gt;
           &lt;obj class=&quot;USlotVisuals&quot; ID=&quot;882712304&quot;&gt;
              &lt;int name=&quot;displaytype&quot; value=&quot;1&quot;/&gt;
              &lt;int name=&quot;articulationtype&quot; value=&quot;0&quot;/&gt;
              &lt;int name=&quot;symbol&quot; value=&quot;73&quot;/&gt;
              &lt;string name=&quot;text&quot; value=&quot;GROUP 3&quot; wide=&quot;true&quot;/&gt;
              &lt;string name=&quot;description&quot; value=&quot;GROUP 3&quot; wide=&quot;true&quot;/&gt;
              &lt;int name=&quot;group&quot; value=&quot;2&quot;/&gt;
           &lt;/obj&gt;
           &lt;obj class=&quot;USlotVisuals&quot; ID=&quot;44402087248&quot;&gt;
              &lt;int name=&quot;displaytype&quot; value=&quot;1&quot;/&gt;
              &lt;int name=&quot;articulationtype&quot; value=&quot;0&quot;/&gt;
              &lt;int name=&quot;symbol&quot; value=&quot;73&quot;/&gt;
              &lt;string name=&quot;text&quot; value=&quot;GROUP 4&quot; wide=&quot;true&quot;/&gt;
              &lt;string name=&quot;description&quot; value=&quot;GROUP 4&quot; wide=&quot;true&quot;/&gt;
              &lt;int name=&quot;group&quot; value=&quot;3&quot;/&gt;
           &lt;/obj&gt;
        &lt;/list&gt;
     &lt;/member&gt;
     &lt;member name=&quot;slots&quot;&gt;
        &lt;int name=&quot;ownership&quot; value=&quot;1&quot;/&gt;
        &lt;list name=&quot;obj&quot; type=&quot;obj&quot;&gt;
           &lt;obj class=&quot;PSoundSlot&quot; ID=&quot;2271687808&quot;&gt;
              &lt;obj class=&quot;PSlotThruTrigger&quot; name=&quot;remote&quot; ID=&quot;2276282784&quot;&gt;
                 &lt;int name=&quot;status&quot; value=&quot;144&quot;/&gt;
                 &lt;int name=&quot;data1&quot; value=&quot;0&quot;/&gt;
              &lt;/obj&gt;
              &lt;obj class=&quot;PSlotMidiAction&quot; name=&quot;action&quot; ID=&quot;2268706176&quot;&gt;
                 &lt;int name=&quot;version&quot; value=&quot;600&quot;/&gt;
                 &lt;member name=&quot;noteChanger&quot;&gt;
                    &lt;int name=&quot;ownership&quot; value=&quot;1&quot;/&gt;
                    &lt;list name=&quot;obj&quot; type=&quot;obj&quot;&gt;
                       &lt;obj class=&quot;PSlotNoteChanger&quot; ID=&quot;2277009712&quot;&gt;
                          &lt;int name=&quot;channel&quot; value=&quot;-1&quot;/&gt;
                          &lt;float name=&quot;velocityFact&quot; value=&quot;1&quot;/&gt;
                          &lt;float name=&quot;lengthFact&quot; value=&quot;1&quot;/&gt;
                          &lt;int name=&quot;minVelocity&quot; value=&quot;0&quot;/&gt;
                          &lt;int name=&quot;maxVelocity&quot; value=&quot;127&quot;/&gt;
                          &lt;int name=&quot;transpose&quot; value=&quot;0&quot;/&gt;
                          &lt;int name=&quot;minPitch&quot; value=&quot;0&quot;/&gt;
                          &lt;int name=&quot;maxPitch&quot; value=&quot;127&quot;/&gt;
                       &lt;/obj&gt;
                    &lt;/list&gt;
                 &lt;/member&gt;
                 &lt;member name=&quot;midiMessages&quot;&gt;
                    &lt;int name=&quot;ownership&quot; value=&quot;1&quot;/&gt;
                 &lt;/member&gt;
                 &lt;int name=&quot;channel&quot; value=&quot;-1&quot;/&gt;
                 &lt;float name=&quot;velocityFact&quot; value=&quot;1&quot;/&gt;
                 &lt;float name=&quot;lengthFact&quot; value=&quot;1&quot;/&gt;
                 &lt;int name=&quot;minVelocity&quot; value=&quot;0&quot;/&gt;
                 &lt;int name=&quot;maxVelocity&quot; value=&quot;127&quot;/&gt;
                 &lt;int name=&quot;transpose&quot; value=&quot;0&quot;/&gt;
                 &lt;int name=&quot;maxPitch&quot; value=&quot;127&quot;/&gt;
                 &lt;int name=&quot;minPitch&quot; value=&quot;0&quot;/&gt;
                 &lt;int name=&quot;key&quot; value=&quot;-1&quot;/&gt;
              &lt;/obj&gt;
              &lt;member name=&quot;sv&quot;&gt;
                 &lt;int name=&quot;ownership&quot; value=&quot;2&quot;/&gt;
                 &lt;list name=&quot;obj&quot; type=&quot;obj&quot;&gt;
                    &lt;obj class=&quot;USlotVisuals&quot; ID=&quot;909444640&quot;&gt;
                       &lt;int name=&quot;displaytype&quot; value=&quot;1&quot;/&gt;
                       &lt;int name=&quot;articulationtype&quot; value=&quot;0&quot;/&gt;
                       &lt;int name=&quot;symbol&quot; value=&quot;73&quot;/&gt;
                       &lt;string name=&quot;text&quot; value=&quot;CUSTOM ART1&quot; wide=&quot;true&quot;/&gt;
                       &lt;string name=&quot;description&quot; value=&quot;CUSTOM ART1 DESCRIPTION&quot; wide=&quot;true&quot;/&gt;
                       &lt;int name=&quot;group&quot; value=&quot;0&quot;/&gt;
                    &lt;/obj&gt;
                    &lt;obj class=&quot;USlotVisuals&quot; ID=&quot;43544745280&quot;&gt;
                       &lt;int name=&quot;displaytype&quot; value=&quot;1&quot;/&gt;
                       &lt;int name=&quot;articulationtype&quot; value=&quot;0&quot;/&gt;
                       &lt;int name=&quot;symbol&quot; value=&quot;73&quot;/&gt;
                       &lt;string name=&quot;text&quot; value=&quot;GROUP 2&quot; wide=&quot;true&quot;/&gt;
                       &lt;string name=&quot;description&quot; value=&quot;GROUP 2&quot; wide=&quot;true&quot;/&gt;
                       &lt;int name=&quot;group&quot; value=&quot;1&quot;/&gt;
                    &lt;/obj&gt;
                    &lt;obj class=&quot;USlotVisuals&quot; ID=&quot;44505641184&quot;&gt;
                       &lt;int name=&quot;displaytype&quot; value=&quot;1&quot;/&gt;
                       &lt;int name=&quot;articulationtype&quot; value=&quot;0&quot;/&gt;
                       &lt;int name=&quot;symbol&quot; value=&quot;73&quot;/&gt;
                       &lt;string name=&quot;text&quot; value=&quot;GROUP 3&quot; wide=&quot;true&quot;/&gt;
                       &lt;string name=&quot;description&quot; value=&quot;GROUP 3&quot; wide=&quot;true&quot;/&gt;
                       &lt;int name=&quot;group&quot; value=&quot;2&quot;/&gt;
                    &lt;/obj&gt;
                    &lt;obj class=&quot;USlotVisuals&quot; ID=&quot;44402092688&quot;&gt;
                       &lt;int name=&quot;displaytype&quot; value=&quot;1&quot;/&gt;
                       &lt;int name=&quot;articulationtype&quot; value=&quot;0&quot;/&gt;
                       &lt;int name=&quot;symbol&quot; value=&quot;73&quot;/&gt;
                       &lt;string name=&quot;text&quot; value=&quot;GROUP 4&quot; wide=&quot;true&quot;/&gt;
                       &lt;string name=&quot;description&quot; value=&quot;GROUP 4&quot; wide=&quot;true&quot;/&gt;
                       &lt;int name=&quot;group&quot; value=&quot;3&quot;/&gt;
                    &lt;/obj&gt;
                 &lt;/list&gt;
              &lt;/member&gt;
              &lt;member name=&quot;name&quot;&gt;
                 &lt;string name=&quot;s&quot; value=&quot;THIS IS SLOT 1&quot; wide=&quot;true&quot;/&gt;   &lt;!--AND THEN THIS--&gt;
              &lt;/member&gt;
              &lt;int name=&quot;color&quot; value=&quot;1&quot;/&gt;
           &lt;/obj&gt;
        &lt;/list&gt;
     &lt;/member&gt;
     &lt;member name=&quot;controller&quot;&gt;
        &lt;int name=&quot;ownership&quot; value=&quot;1&quot;/&gt;
     &lt;/member&gt;
  &lt;/instrument&gt;
  </code></pre>