为什么ServerXMLHTTP发送方法返回自动化错误?

时间:2014-02-27 16:40:05

标签: html xml vba xmlhttprequest

我想知道是否有人可以在他们的系统上重现这一点:下面显示的功能在运行Office 2013的Windows 7上运行正常,但它在运行Windows 7和Office的另一个系统上的XMLhttp.send处生成“自动化错误” 2010.我或许还应该提到第一个系统有IE 11,而第二个系统(我得到自动化错误)有IE 8.任何想法?提前致谢

Public Function getWiki(ByVal name As String) As String
  Dim XMLhttp: Set XMLhttp = CreateObject("MSXML2.ServerXMLHTTP")
  XMLhttp.setTimeouts 2000, 2000, 2000, 2000
  XMLhttp.Open "GET", "http://en.wikipedia.org/wiki/" & name, False
  XMLhttp.send

  If XMLhttp.Status = 200 Then
    getWiki = XMLhttp.responseText
  Else
    getWiki = ""
  End If
End Function

0 个答案:

没有答案