title: VBA Excel pulling new webpage data after clicking on "submit"
body: <p>I'm trying to pull some info from a website that provides oil well data by API number (API is a unique number for every well in the US)</p>
  
  <p>Website: <a href="http://sonlite.dnr.state.la.us/sundown/cart_prod/cart_con_wellapi1" rel="nofollow">http://sonlite.dnr.state.la.us/sundown/cart_prod/cart_con_wellapi1</a></p>
  
  <p>API example: 1708300502</p>
  
  <p>The issue is, when I get to the 2nd page, IE.document.getElementsByTagName("body")(0).innerText still returns data from the initial page. How do I fetch the updated page data?</p>
  
  <p>The ultimate goal is to get to the 2nd page, click on "30570" via IE.document.getElementsByTagName("a")(0).Click and then read the final 3rd page. I just cannot figure out how to read the updated page :(</p>
  
  <pre><code>Option Explicit
  
  Sub sonris_WellData()
     Dim IE As InternetExplorer
     Set IE = CreateObject("InternetExplorer.Application")
     IE.Visible = True
  
     Dim i As Integer
  
     'Open SONRIS website
     Application.StatusBar = "Opening Website"
     IE.navigate "http://sonlite.dnr.state.la.us/sundown/cart_prod/cart_con_wellapi1"
     Do While IE.readyState &lt;&gt; 4: DoEvents: Loop
     Application.Wait Now() + TimeValue("00:00:01")
     Application.StatusBar = False
  
     IE.document.forms(0).p_apinum.Value = "1708300502" 'plug-in API
     IE.document.forms(0).submit
  
     ' Wait until the next page opens
     Application.StatusBar = "Opening Website"
     Do While IE.readyState &lt;&gt; 4: DoEvents: Loop
     Application.Wait Now() + TimeValue("00:00:01")
     Application.StatusBar = False
  
     ' Read the page - this is where the issue occurs, MsgBox keeps returning text from the very 1st page
     MsgBox IE.document.getElementsByTagName("body")(0).innerText
  
     IE.Quit
  End Sub
  </code></pre>