title: Excel VBA: output the result of a WinHTTPRequest in Excel?
body: <p>How do I output the result of a <code>WinHTTPRequest</code> in Excel?</p>
  
  <p>For example, the following code queries the stock quote of Apple from a webpage but it doesn't output anything:</p>
  
  <pre><code>Sub GetQuotes()
  
       Dim XMLHTTP As Object, html As Object, pontod As Object
  
       On Error Resume Next
       Set oHtml = New HTMLDocument
       With CreateObject("WINHTTP.WinHTTPRequest.5.1")
           .Open "GET", "http://www.reuters.com/finance/stocks/overview?symbol=AAPL.O", False
           .send
           oHtml.body.innerHTML = .responseText
       End With
  
       'Price
       Set pontod = oHtml.getElementsByClassName("sectionQuote nasdaqChange")(0).getElementsByTagName("span")(1)
       MsgBox pontod.innerText
  
  End Sub
  </code></pre>
  
  <p>While this runs perfectly for the name:</p>
  
  <pre><code>Sub GetQuotes2()
  
       Dim XMLHTTP As Object, html As Object, pontod As Object
  
       On Error Resume Next
       Set oHtml = New HTMLDocument
       With CreateObject("WINHTTP.WinHTTPRequest.5.1")
           .Open "GET", "http://www.reuters.com/finance/stocks/overview?symbol=AAPL.O", False
           .send
           oHtml.body.innerHTML = .responseText
       End With
  
       'Name
       Set pontod = oHtml.getElementById("sectionTitle").getElementsByTagName("h1")(0)
       MsgBox pontod.innerText
  
  End Sub
  </code></pre>
  
  <p>I'd like to be able to fetch the whole page and look for specific HTML elements in it, but how do I manage to see the whole response from the query?</p>