Skip to content

Instantly share code, notes, and snippets.

@suatatan
Created January 22, 2013 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suatatan/e377de41ce7f6ea94ba3 to your computer and use it in GitHub Desktop.
Save suatatan/e377de41ce7f6ea94ba3 to your computer and use it in GitHub Desktop.
Send data over excel VBA (macro)
Sub Macro1()
Dim result As String
Dim myURL As String, postData As String
Dim winHttpReq As Object
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
myURL = "http://localhost:8082/ws"
postData = "q=suat"
winHttpReq.Open "POST", myURL, False
winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
winHttpReq.Send (postData)
result = winHttpReq.responseText
MsgBox (result)
ActiveWorkbook.Save
ActiveWorkbook.Save
ActiveWorkbook.Save
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment