加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程 > 正文

sql-server – 行使HTTP Post将数据从excel发送随处事器

发布时间:2021-03-30 22:12:23 所属栏目:编程 来源:网络整理
导读:怎样行使HTTP Post从excel发送数据随处事器? 可以说URL是:http://testingHttpPost/ 我想从单位格A2和B2发送数据.我如安在VBA中完成此操纵? 提前叩谢 办理要领 Sub XMLPost()Dim xmlhttp,sData As String With ActiveSheet sData = "x=" URLencode(.Range("

怎样行使HTTP Post从excel发送数据随处事器?

可以说URL是:http://testingHttpPost/

我想从单位格A2和B2发送数据.我如安在VBA中完成此操纵?

提前叩谢

办理要领

Sub XMLPost()
Dim xmlhttp,sData As String

    With ActiveSheet
        sData = "x=" & URLencode(.Range("A2").Value) & _
                "&y=" & URLencode(.Range("B2").Value)
    End With

    Set xmlhttp = CreateObject("microsoft.xmlhttp")

    With xmlhttp
        .Open "POST"," http://testingHttpPost/",False
        .setrequestheader "Content-Type","application/x-www-form-urlencoded"
        .send sData
        Debug.Print .responsetext
    End With
End Sub

对付URLencode成果,请拜见此处:How can I URL encode a string in Excel VBA?

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读