title: Run-time error '91' (Object variable or With block variable not set)
body: <p>I am relatively new to VBA and am trying to put together a msgbox that will give me a specific number from a web scrape, however I keep running into a run-time error '91' and I simply cannot figure out how to fix this. I have searched countless stackoverflow questions, youtube videos and generic google searches, however have not been successful in finding out the error on my own.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>Set IE = CreateObject("InternetExplorer.Application")
  IE.Visible = True
  IE.Navigate ("http://brokercheck.finra.org")
  Do
  DoEvents
  Loop Until IE.ReadyState = 4
  
  'Enter values from the corresponding sheet
  'Set some generic typing for ease
  Set doc = IE.document
  
      doc.GetElementbyID("GenericSearch_IndividualSearchText").Value = Worksheets("Master").Range("D203")
      doc.GetElementbyID("GenericSearch_EmploymingFirmSearchText").Value = Worksheets("Master").Range("C203")
  
      Set elements = doc.getElementsByTagName("button")
      For Each element In elements
      If element.getAttribute("type") = "submit" Then
          element.Click
          Exit For
      End If
      Next element
  
  Do
  DoEvents
  Loop Until IE.ReadyState = 4
  
  'find CRD#
      Set crd = doc.getElementsByClassName("summarydisplaycrd")(0).innerText 'here is where the run time error occurs
      MsgBox crd
  </code></pre>
  
  <p>and the HTML I am trying to get the information from:</p>
  
  <pre><code>&lt;div class="searchresulttext"&gt;
      &lt;div class="bcrow"&gt;
          &lt;div class=""&gt; &lt;span class="summarydisplayname"&gt;[redacted]&lt;/span&gt; &lt;span class="summarydisplaycrd text-nowrap"&gt;(CRD# 5944070)&lt;/span&gt;&lt;/div&gt;
  </code></pre>