【问题标题】:how to send a HTTP Post in (vb mac excel 2011), and read the HTTP response? [duplicate]如何在(vb mac excel 2011)中发送 HTTP Post,并读取 HTTP 响应? [复制]
【发布时间】:2012-10-11 13:35:27
【问题描述】:

可能重复:
Sending http requests with VBA from Word

如何在 (vb mac office excel 2011) 中发送 HTTP Post,并读取 HTTP 响应? 并请提供明确的答案,我是vb的新手。

不是 Windows Office,而是 Mac Office 2011!

提前致谢!

【问题讨论】:

    标签: vb.net excel http http-post


    【解决方案1】:

    这是link to a similar question answered in 2010。此处粘贴的代码来自该链接。

    Sub http()
    Dim MyRequest As Object
    
        Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
        MyRequest.Open "GET", "http://www.google.com"
    
        ' Send Request.
        MyRequest.Send
    
        'And we get this response
        MsgBox MyRequest.ResponseText
    
    End Sub
    

    如果您还需要更多建议,请告诉我。

    【讨论】:

    • 是的,这有效,但仅适用于 Windows。我需要 MAC office excel 2011 的帮助,而不是 windows office。但无论如何感谢 Uwe Keim!
    • 约翰,对不起,我在你的标题中看到了“mac”并假设为“macro”。这是另一种方式,不太优雅;但它会出现跨平台。 Alternate method on StackOverflow
    • 我已经尝试过了,但是 Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") 和 Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") 给我一个运行时错误 429,activex组件无法创建对象
    • ops 等等,我尝试了错误的代码 :)
    • 它工作!谢谢唐尼麦考伊 3!写解决方案,我会把它标记为你的答案。我希望其他人可以清楚地了解该线程:)
    猜你喜欢
    • 1970-01-01
    • 2011-12-21
    • 2011-09-15
    • 2011-03-03
    • 2016-03-01
    • 1970-01-01
    • 2013-01-16
    • 2016-11-16
    • 1970-01-01
    相关资源
    最近更新 更多