title: How to VBA sends an Async XMLHTTP request?
body: <p>To get data from a webservice in Excel, I have created an excel addin provide function to get it; user just need type in cell:
  <code>=sendRequest("http://webservice.com")</code></p>
  
  <p>I have 2 excel files to demostrate the <code>sending request</code> in two methods: 1.<a href="https://dl.dropbox.com/u/60740207/TestHttpReqest%20-%20Sync.xlsm" rel="nofollow">synchronous</a> and 2.<a href="https://dl.dropbox.com/u/60740207/TestHttpReqest%20-%20ASync.xlsm" rel="nofollow">asynchronous</a></p>
  
  <p>In <code>sync</code> method, the function can send request and get data normaly. But, if we <strong>have 100, 200 cells</strong> that call it, it will take Excel a huge amount of time waiting; which also makes Exel to be <strong>not respoding</strong>. </p>
  
  <p>My current solution for this is to use <code>async</code> method as <a href="http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/" rel="nofollow">below code</a></p>
  
  <pre><code>Public Function sendAsyncRequest(URL)
      'other statement
  
      ' Get some stuff asynchronously.
      xmlHttpRequest.Open "GET", URL, True
      xmlHttpRequest.send
      sendAsyncRequest = xmlHttpRequest.responseText
  End Function
  </code></pre>
  
  <p>But the cell's value is alway is zero 0 instead of repsone text.</p>
  
  <p>I must use my handler class to bind it with <code>OnReadyStateChange</code> of <code>xmlHttpRequest object</code> to set response text into cell. But then, it also clears the cells' formulas. </p>
  
  <p>So my question is <strong>How to change the display text of cell without changing its formula?</strong></p>
  
  <p>I also welcome another solution to send request and get return value under <code>async</code> method.</p>