title: Error from VB excel macro code - msxml3.dll -2146697211 The system cannot locate the resource specified
body: <p>I am using an <code>MSXML.HTTPRequest</code> object in a VB macro (excel) to communicate with an HTTP server. The problem is that it throws the following error intermittently.</p>
  
  <blockquote>
    <p>msxml3.dll -2146697211 The system cannot locate the resource
    specified.</p>
  </blockquote>
  
  <p>I noticed on my system that this happened when the network was down, but my client has complained of it happening intermittently on his machine. Given that his system has Windows 7 installed and it is working at times, I don't think it is an issue of the correct library not being installed. He has tried it on a few networks, but it still fails.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Function xmlHTTPPost(strURL, strData)
      Dim objHttp
  
      On Error Resume Next
      xmlHTTPPost = ""
      Set objHttp = CreateObject("Microsoft.XMLHTTP")
      If Err.Number &lt;&gt; 0 Then
          Err.Clear
          Set objHttp = CreateObject("MSXML2.XMLHTTP")
      End If
      If Err.Number &lt;&gt; 0 Then
          MsgBox "Error creating XMLHTTP object"
          Err.Clear
          Exit Function
      End If
      objHttp.Open "GET", strURL, False
      If Err.Number &lt;&gt; 0 Then
          Err.Clear
          Set objHttp = Nothing
          Exit Function
      End If
      objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
      objHttp.setRequestHeader "User-Agent", "Mozilla Compatible (MS IE 3.01 WinNT)"
      objHttp.Send
      If Err.Number &lt;&gt; 0 Then
          MsgBox "Error " &amp; Hex(Err.number) &amp; " sending to server:" &amp; vbCrLf &amp; Err.description
          xmlHTTPPost = "ERROR: " &amp; Err.Source &amp; " " &amp; Err.Number &amp; " " &amp; Err.Description
          Err.Clear
      Else
          xmlHTTPPost = objHttp.responseText
      End If
      Set objHttp = Nothing
  End Function
  </code></pre>
  
  <p>It's working perfectly on my box, which is a Windows 7 + Microsoft Office 2007 installation.</p>
  
  <p>I have searched a lot online, and two reasons have been vaguely mentioned. </p>
  
  <ol>
  <li>Network issues due to proxy or firewall. In this case it should never connect, not intermittently.</li>
  <li>Library installation issue. Again, it shouldn't work at all but that's not the case. </li>
  </ol>