title: Using xmlhttprequest in vba, How do I get elements that dont load in the initial request
body: <p>I am trying to interact with the chat screen of Microsoft teams using xmlhttprequests within vba. I am new to xmlhttprequest (xmlhr) and I am stuck at a point where the majority of the page has loaded but not the chat window. I can use .getelementbyid to get the flex-fill element but it doesn't have the divs or any messages in the responseText.</p>
  <p>I assume it is waiting for the inner frame to load or to be visible, but I don't know how to call a second request without using a new xmlhttprequest.</p>
  <p>I am using:</p>
  <pre><code>Dim myUrl as string
  MyUrl = &quot;https://teams.microsoft.com/_?tenantid=xxxxx&quot;
  Dim xmlhttp as new MSXML2.xmlhttp60
  Xmlhttp.open &quot;get&quot;, myUrl, false
  Xmlhttp.setrequestheader &quot;content-type&quot;, &quot;Application/xml&quot;
  Xmlhttp.send
  
  Dim html as new htmldocument
  Html.body.innerhtml = xmlhttp.responsetext
  Set testing = html.getelementbyid(=page-content-wrapper&quot;)
  'this works fine but there are no children past the next child
  </code></pre>
  <p>When I look at the developer tool for the site, the messages are in this element but in the xmlhttprequest I can only see the outermost frame of the chat window.</p>
  <p>Any help would be greatly appreciated.</p>