0

Possible Duplicate:
Sending http requests with VBA from Word

how to send a HTTP Post in (vb mac office excel 2011), and read the HTTP response ? and please provide clear answers, I am new in vb.

not windows office, mac office 2011 !

thanks in advance !

Community
  • 1
  • 1
Johan Polson
  • 117
  • 3
  • 12

1 Answers1

-1

Here is a link to a similar question answered in 2010. Code pasted here is from that link.

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

Please let me know if you still need more advice.

Community
  • 1
  • 1
Donny McCoy
  • 130
  • 7
  • yes this works, but only on the windows. I need help with MAC office excel 2011, not windows office. but thanks anyway Uwe Keim ! – Johan Polson Oct 11 '12 at 14:16
  • Johan, I apologize, I saw "mac" in your title and assumed "macro". Here is another way, less elegant; but cross-platform it would appear. [Alternate method on StackOverflow](http://stackoverflow.com/questions/158633/how-can-i-send-an-http-post-request-to-a-server-from-excel-using-vba) – Donny McCoy Oct 11 '12 at 14:53
  • I've already tried it, but both Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") and Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") gives me a runtime error 429,activex component can't create object – Johan Polson Oct 11 '12 at 15:17
  • ops wait, I tried the wrong code : ) – Johan Polson Oct 11 '12 at 15:29
  • it work! thanks Donny McCoy 3! write solution, and I'll mark it as answer for you. I want the thread to be clear for others :) – Johan Polson Oct 11 '12 at 18:29
  • How did you add the references to the project? I don't see WinHttpRequest on OSX – phact Aug 27 '14 at 16:00