title: Extracting div class information from website with VBA
body: <p>I've been trying to scrape the following page for research purposes: <a href="http://www.brazil4export.com/en/pesquisa/resultado/?page=1&amp;" rel="nofollow noreferrer">http://www.brazil4export.com/en/pesquisa/resultado/?page=1&amp;</a></p>
  
  <p>A piece of HTML I want to get information from is the following:</p>
  
  <pre><code>&lt;div class="panel panel-default"&gt;
    &lt;div class="panel-heading" data-activity="22196 - Manufacturer" data-products='["Products", "Information"]' data-range="Value" data-contact="Person" data-site="www.website.com.br" data-emails="name@example.com" data-phones="Phone" data-address="Street / City" data-countries='["Country1", "Country2"]' data-name="ACME Corp."&gt;
      &lt;h3 class="panel-title"&gt;
        &lt;button class="btn btn-link" data-toggle="modal" data-target="#company-modal"&gt;
          ACME Corp.
        &lt;/button&gt;
      &lt;/h3&gt;
      &lt;button class="btn btn-primary btn-lg pull-right" data-toggle="modal" data-target="#company-modal"&gt;
        &lt;i class="icon-plus"&gt;&lt;/i&gt;
      &lt;/button&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>For each result on the page, there's a <code>&lt;div class="panel panel-default"&gt;</code>, just as the above, and I want to get the <code>data-name</code> and <code>data-site</code> information from each of them. This is what I've tried, so far:</p>
  
  <pre><code>Sub useClassnames()
    Dim element As IHTMLElement
    Dim elements As IHTMLElementCollection
    Dim ie As InternetExplorer
    Dim html As HTMLDocument
  
    'open Internet Explorer in memory, and go to website
    Set ie = New InternetExplorer
  
    ie.Visible = True
    ie.navigate "http://www.brazil4export.com/en/pesquisa/resultado/?page=1&amp;"
    'Wait until IE has loaded the web page
  
    Do While ie.READYSTATE &lt;&gt; READYSTATE_COMPLETE
      Application.StatusBar = "Loading Web page …"
      DoEvents
    Loop
  
    Set html = ie.document
    Set elements = html.getElementsByClassName("panel panel-default")
  
    Dim erow As Long
  
    For Each element In elements
      If element.className = "data-name" Then
        erow = Sheet1.Cells(Rows.count, 1).End(xlUp).Offset(1, 0).Row
        Cells(erow, 2) = html.getElementsByClassName("data-name").innerText
      End If
  
      If element.className = "data-site" Then
        erow = Sheet1.Cells(Rows.count, 1).End(xlUp).Offset(1, 0).Row
        Cells(erow, 3) = html.getElementsByClassName("data-site").innerText
      End If
    Next element
  
  End Sub
  </code></pre>
  
  <p>It doesn't work, but doesn't show me any errors as well. </p>