加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Error from VB excel macro code - msxml3.dll -2146697211 The

发布时间:2020-12-17 07:39:07 所属栏目:百科 来源:网络整理
导读:I am using an MSXML.HTTPRequest object in a VB macro (excel) to communicate with an HTTP server. The problem is that it throws the following error intermittently. msxml3.dll -2146697211 The system cannot locate the resource specified. I no

I am using an MSXML.HTTPRequest object in a VB macro (excel) to communicate with an HTTP server. The problem is that it throws the following error intermittently.

msxml3.dll -2146697211 The system cannot locate the resource specified.

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.

Function xmlHTTPPost(strURL, strData) Dim objHttp OnErrorResumeNext xmlHTTPPost = ""Set objHttp  CreateObject("Microsoft.XMLHTTP"If Err.Number <> 0ThenClear "MSXML2.XMLHTTP"End MsgBox "Error creating XMLHTTP object"Exit objHttpOpen "GET" strURLFalseNothingsetRequestHeader "Content-Type""application/x-www-form-urlencoded""User-Agent""Mozilla Compatible (MS IE 3.01 WinNT)"Send "Error " & HexErrnumber" sending to server:" vbCrLf description xmlHTTPPost "ERROR: "Source " "Description ErrElseresponseText Function

It's working perfectly on my box,which is a Windows 7 + Microsoft Office 2007 installation.

I have searched a lot online,and two reasons have been vaguely mentioned.

  1. Network issues due to proxy or firewall. In this case it should never connect,not intermittently.
  2. Library installation issue. Again,it shouldn't work at all but that's not the case.

I would really appreciate any help on this.


Answers



For now I was able to solve this by changing the method from GET to POST. The error was intermittent but fortunately it started showing up on my dev machine once,and changing the HTTP method to POST did the trick. It's very odd that should happen though,but it worked.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读