use*_*468 1 sql-server asp.net-mvc vba http-post
如何使用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
Run Code Online (Sandbox Code Playgroud)
对于URLencode函数,请参见此处:如何在Excel VBA中对字符串进行URL编码?
| 归档时间: |
|
| 查看次数: |
6134 次 |
| 最近记录: |