Perform HTTP Post from within Excel and Parse Results

前端 未结 4 1581
感动是毒
感动是毒 2020-12-14 23:26

I have access to an API. The API takes an XML post as input and then returns an XML response with the relevant data.

I want to

  1. Send the HTTP Post to
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-15 00:06

    The Excel request side can be handled with this VBA code.

    Sub GetStuff()
    
    Dim objXML As Object
    Dim strData As String
    Dim strResponse As String
    
     strData = "Request"
     Set objXML = CreateObject("MSXML2.XMLHTTP")
    
     objXML.Open "POST", "www.example.com/api?" & strData, False
     objXML.Send
     strResponse = objXML.responsetext
    
    MsgBox strResponse
    
    End Sub
    

提交回复
热议问题