title: Submit form and fetch data from website VBA
body: <p>I'm trying to fetch data from this <a href="http://www.finanztreff.de/" rel="nofollow noreferrer">site</a> using VBA in Excel. What I tried to do and what worked was using InternetExplorer object like this:</p>
  
  <pre><code>Set IE = CreateObject("InternetExplorer.Application")
  IE.Visible = False
  IE.Navigate "http://zertifikate.finanztreff.de"
  IE.document.getElementById("USFsecuritySearchDropDown").Value = "DE000BP5TBQ2"
  IE.document.getElementById("USFsecuritySearchDropDownForm").submit
  
  Do While IE.Busy Or IE.readyState &lt;&gt; 4  'wait until page is loaded
      Application.Wait DateAdd("s", 1, Now)
  Loop
  MsgBox IE.document.getElementById("BP5TBQ~30~5").innerHTML
  </code></pre>
  
  <p>However this worked very slow and didn't get always the right results. I suspect that sometimes it didn't wait until webpage was loaded. I tried to look for answers and I found <a href="https://stackoverflow.com/questions/17480369/vba-hanging-on-ie-busy-and-readystate-check">this answer on stackoverflow</a>. Now I'm trying to figure out how to rewrite my macro using MSXML2 and MSHTML. So far I was able to do this : </p>
  
  <pre><code>Dim IE As MSXML2.XMLHTTP60
  Set IE = New MSXML2.XMLHTTP60
  
  IE.Open "GET", "http://zertifikate.finanztreff.de", False
  IE.send
  While IE.ReadyState &lt;&gt; 4
      DoEvents
  Wend
  
  Dim HTMLDoc As MSHTML.HTMLDocument
  Dim htmlBody As MSHTML.htmlBody
  
  Set HTMLDoc = New MSHTML.HTMLDocument
  Set htmlBody = HTMLDoc.body
  htmlBody.innerHTML = IE.responseText
  HTMLDoc.getElementById("USFsecuritySearchDropDown").Value = "DE000BP5TBQ2"
  </code></pre>
  
  <p>please, why HTMLDoc has method getElementById and htmlBody doesn't ? How could I submit form "USFsecuritySearchDropDownForm". I tried this :</p>
  
  <pre><code> HTMLDoc.getElementById("USFsecuritySearchDropDownForm").submit
  </code></pre>
  
  <p>, but it always open new window in my default browser, I would like to have it hidden.
  It seems to me that I am missing difference between XMLHTTP60 and MSHTML.HTMLDocument.
  If you could please help me or at least show me where I can find this information I would be really thankful...</p>