title: Query div element by class name using Excel VBA
body: <p>I'm trying to get the data to Excel of a div element with a specific class name, like:</p>
  
  <pre><code>&lt;div class="myClass"&gt;
     &lt;span&gt;Text1&lt;/span&gt;
     &lt;span&gt;Text2&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My VBA code:</p>
  
  <pre><code>Sub GetData()
  Dim oHtml       As HTMLDocument
  Dim oElement    As Object
  
  Set oHtml = New HTMLDocument
  
  With CreateObject("WINHTTP.WinHTTPRequest.5.1")
      .Open "GET", "http://www.example.com/", False
      .send
      oHtml.body.innerHTML = .responseText
  End With
  
  For Each oElement In oHtml.getElementsByClassName("myClass")
      Debug.Print oElement.Children(0).src
  Next oElement
  End Sub
  </code></pre>
  
  <p>This is returning the error: 
  Run-time error: '438': Object doesn't support this property or method. The error is on line Debug.Print ...</p>
  
  <p>I have activated the following refereces:
  Microsoft HTML Object Library
  Microsoft Internet Controls</p>
  
  <p>I want to be able to select the text on the first or second span and paste it on a cell, how can I do this?</p>