1 回答
TA贡献1810条经验 获得超5个赞
不需要脚本控件对象:可以使用 XMLHTTP 和 VBA-JSON。
例如:
Public Sub Tester()
'Import the "JsonConverter.bas" file from
' https://github.com/VBA-tools/VBA-JSON
'and add a reference to the Microsoft Scripting Runtime library
Dim http As Object, JSON As Object, i As Integer, o As Object, k
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", "https://www.alphavantage.co/query?" & _
"function=CURRENCY_EXCHANGE_RATE&from_currency=USD" & _
"&to_currency=JPY&apikey=demo", False
http.Send
Debug.Print http.responseText
Debug.Print "-----------------------------------"
Set JSON = ParseJson(http.responseText)
Set o = JSON("Realtime Currency Exchange Rate")
For Each k In o.keys
Debug.Print k, o(k)
Next k
End Sub
添加回答
举报