title: Excel VBA To Extract Data From a TD
body: <p>I'm trying to use Excel VBA to extract the search result names from a table on a webpage (<a href="https://lambda.byu.edu/ae/prod/person/cgi/personLookup.cgi" rel="nofollow noreferrer">https://lambda.byu.edu/ae/prod/person/cgi/personLookup.cgi</a>).</p>
  <p>In the past, I've used code like the following to extract data from a webpage. But I can't seem to figure out how to extract the text from a td tag. The code I’m using gives me a Run-time error ‘424’: Object required.</p>
  <p>Any suggestions?</p>
  <pre><code>    Sub Macro1()
  Dim IE As Object
  Set IE = CreateObject(&quot;InternetExplorer.Application&quot;)
  Dim Doc As HTMLDocument
  IE.navigate &quot;https://lambda.byu.edu/ae/prod/person/cgi/personLookup.cgi&quot;
  IE.Visible = True
  While IE.Busy Or IE.readyState &lt;&gt; 4
      DoEvents
  Wend
  
  Dim i As Integer, iNumberOfLoops As Integer
  iNumberOfLoops = Sheets(&quot;Extract&quot;).Range(&quot;D2&quot;).Value
  
  For i = 1 To iNumberOfLoops
  
  IE.document.all(&quot;inpSearchPattern&quot;).Value = ThisWorkbook.Sheets(&quot;Extract&quot;).Range(&quot;A1&quot;)
  
  Set objCollection = IE.document.getElementsByTagName(&quot;input&quot;)
  
  i = 0
      While i &lt; objCollection.Length
         'MsgBox &quot;i= &quot; &amp; i &amp; &quot; Name &quot; &amp; objCollection(I).Name &amp; _
          &quot; Value &quot; &amp; objCollection(I).Value &amp; _
          &quot; Type &quot; &amp; objCollection(I).Type
         If (objCollection(i).Value = &quot;Lookup&quot; And objCollection(i).Type = &quot;button&quot;) Then
             Set objElement = objCollection(i)
         End If
          i = i + 1
      Wend
  
      objElement.Click
                
  Dim aA As String
  aA = Trim(Doc.getElementByTagName(&quot;td&quot;)(0).innerText)
  Sheets(&quot;Sheet1&quot;).Range(&quot;C6&quot;).Value = aA
  
  Next i
  
  End Sub
  </code></pre>