2012-10-11 92 views

回答

0

這是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 

請讓我知道,如果你還需要更多的建議。

+0

是的這個工程,但只在窗戶上。 我需要MAC office excel 2011的幫助,而不是windows office。 但無論如何感謝Uwe Keim! –

+0

Johan,我很抱歉,我在標題中看到「mac」,並假定爲「宏」。這是另一種方式,不太優雅;但它會出現跨平臺。 [替代方法StackOverflow](http://stackoverflow.com/questions/158633/how-can-i-send-an-http-post-request-to-a-server-from-excel-using-vba) –

+0

我已經嘗試過,但都 設置objHTTP =的CreateObject( 「MSXML2.ServerXMLHTTP」) 和 設置objHTTP =的CreateObject( 「WinHttp.WinHttpRequest.5.1」) 給了我一個運行時錯誤429,ActiveX組件不能創建對象 –