title: How to read a IE table text with VBA?
body: <p>I am trying to write a vba code in order to follow this process:</p>
  
  <ol>
  <li><p>Automatic Web form fill in and submitting (a new web page opens with the answer <a href="http://ec.europa.eu/taxation_customs/vies/?locale=en" rel="nofollow noreferrer">http://ec.europa.eu/taxation_customs/vies/?locale=en</a>)</p></li>
  <li><p>Find the address of the new webpage (because i will need to read this content)</p></li>
  <li><p>Read a specific cell of the html table (the name of the company)</p></li>
  </ol>
  
  <p>You can try to manualy submit the for with the VAT number FR(FRANCE) and 27435044714.
  It will return a page including the name of the company. </p>
  
  <p>Basically I am struggling to extract the name of the company.</p>
  
  <p>Step 1 works very well and is independent from step 2 &amp; 3.
  Step 2 and step 3 are on a same Sub:</p>
  
  <p>The macro starts with the step 2 (finding the opened webpage)</p>
  
  <pre><code>Sub recup()
  Dim SWs As SHDocVw.ShellWindows, IE As SHDocVw.InternetExplorer 
  'Establish link to IE application
  Set SWs = New SHDocVw.ShellWindows
  
  For Each IE In SWs
      If Left(IE.LocationURL, 4) &lt;&gt; "http" Then
      GoTo autre
      End If
      Address = IE.LocationURL
      GoTo vabene 'avoid explorer windows/etc this way
  autre:
  Next
  vabene:
  </code></pre>
  
  <p>Then, I proceed to the step 3 in order to extract the text.</p>
  
  <pre><code>IE.Visible = True
  Dim xobj
  Set IE = CreateObject("InternetExplorer.Application")
  IE.Visible = True
  Set xobj =IE.Document.getElementById("vatResponseFormTable").getElementsByClassName("labelStyle").Item(3)
  Set xobj = xobj.getElementsByTagName("td").Item(0)
  result = xobj.innerText
  Set xobj = Nothing
  IE.Quit
  Set IE = Nothing
  End Sub
  </code></pre>
  
  <p>My problem: the macro stops on the line (Runtime error 91): </p>
  
  <blockquote>
    <p>result = xobj.innerText</p>
  </blockquote>
  
  <p>This seems to come from the previous line </p>
  
  <blockquote>
    <p>Set xobj = xobj.getElementsByTagName("td").Item(0)</p>
  </blockquote>
  
  <p>I search a lot into the web and this forum (it helped me until this step). If you can help me that would save my week !</p>