I had to add a reference by going to Tools|Reference, then select Microsoft winhttp service version 5.1
Then I added the following code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 22/10/2009 by John Hufnagel
'
url = "http://www.google.ca/"
postmydata = "variable=data&variable2=data2"
Dim HttpReq As Object
Set HttpReq = New WinHttpRequest
HttpReq.Open "POST", url, False
'or use GET instead of POST
HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
HttpReq.send postmydata
'Note - if using GET set postmydata to ""
MsgBox (HttpReq.responseText)
End Sub
Now that I have the basic GET working, the next challange is to make a Yahoo! Web Service REST Call
No comments:
Post a Comment