2

Is there any way to craft an Excel hyperlink formula that would send an HTTP POST on click and parse the response to populate another cell?

Lance Roberts
  • 21,757
  • 30
  • 108
  • 129
Sean
  • 21
  • 3

2 Answers2

0
Public Function HttpPOST(ByVal URL As String) As String
    Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
    objHTTP.Open "POST", URL, False
    objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
   objHTTP.send ("")
   myText = objHTTP.responseText
   getHTTP2 = myText

End Function
Tono Nam
  • 31,694
  • 75
  • 272
  • 444
0

[EDIT] Sorry, i didn't see "no vba" in your title. But i can't see how you would do.

You can do it with vba and find valuable information on these threads:

Here is a code sample:

'Send the request
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
   URL = "http://www.somedomain.com"
   objHTTP.Open "POST", URL, False
   objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
   objHTTP.send ("")

'Get the result
myText = objHTTP.responseText

'Set it in the current cell
ActiveCell.Value = myText

Regards,

Community
  • 1
  • 1
JMax
  • 25,301
  • 12
  • 66
  • 87