|
本帖最后由 fan0217 于 2017-4-1 10:55 编辑
这里只提供了Http的Get方法,只抛砖引玉,更多方法,就自己摸索了。
直接上代码,示例为转换人民币大写:
- Public Function HttpGet(url As String) As String
- Dim xmlHttp As Object
- Set xmlHttp = CreateObject("Msxml2.XMLHTTP.3.0")
- If Not IsObject(xmlHttp) Then
- Set xmlHttp = CreateObject("Msxml2.XMLHTTP.3.0")
- If Not IsObject(xmlHttp) Then Exit Function
- End If
- xmlHttp.Open "GET", url, False
- xmlHttp.setRequestHeader "CONTENT-TYPE", "application/text;charset=UTF-8"
- xmlHttp.send
- Do While xmlHttp.ReadyState <> 4
- DoEvents
- Loop
-
- Dim ret As String
- ret = xmlHttp.responseText
- HttpGet = ret
- End Function
- Public Function CapitalRMB(num As Double) As String
- Dim apiuri As String
- apiuri = "https://e.skyerp.cn/laimf/RMB.ashx?Num=" & num
- Dim ret As String
- ret = HttpGet(apiuri)
- CapitalRMB = ret
- End Function
复制代码
测试:
- Sub TestRMB() '转换RMB
- Debug.Print CapitalRMB(1234567.89)
- End Sub
复制代码
返回:壹佰贰拾叁万肆仟伍佰陆拾柒元捌角玖分
附例子:
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
评分
-
查看全部评分
|