title: How to VBA catch request timeout error?
body: <p>I'm using object <a href="http://msdn.microsoft.com/en-us/library/ms762278%28v=vs.85%29" rel="nofollow noreferrer">MSXML2.ServerXMLHTTP60</a> send request to webservice; with this object, I can speed up data loading by <strong>asynchronous</strong> method and avoid lockups Excel screen (<em>not responding</em>). But, I'm still have a problem when webservice response for a long time, out of ServerXMLHTTP60 timeout setting, the request function was silently, I cannot catch timeout error. At <a href="https://stackoverflow.com/questions/11407010/how-to-vba-callback-function-when-xmlhttp-ontimeout">another question</a>, @osknows suggests using <code>xmlhttp status = 408</code> to catching timeout error, but it doesn't work for me.</p>
  
  <p>I've prepaired a test file, you can download <a href="https://dl.dropbox.com/u/60740207/testTimeout.xlsm" rel="nofollow noreferrer">at here</a>. Open VBA source by press <code>Atl + F8</code>, you will see class module <code>CXMLHTTPHandler</code>, that I copied from <a href="http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/" rel="nofollow noreferrer">this guide</a></p>
  
  <pre><code>    If m_xmlHttp.readyState = 4 Then
          If m_xmlHttp.Status = 200 Then
              MsgBox m_xmlHttp.responseText
          ElseIf m_xmlHttp.Status = 408 Then 'Debug never run to here?
              MsgBox "Request timeout"
          Else
           'Error happened
          End If
      End If
  </code></pre>
  
  <p><strong>How to VBA catch request timeout error?</strong> </p>
  
  <p>Thank for your help!</p>