小编ken*_*tam的帖子

VBA获取在线货币

最近,我刚刚意识到雅虎财务(.csv)已关闭,导致我无法在Excel中进行在线货币(更新)。因此,我尝试使用以下方法进行工作。

1)网站:http : //www.google.com/search?q= “ A” + to +“ B” /

2)正如我已经注意到的,货币汇率将显示在div class =“ dDoNo vk_bk”中

以下是我正在尝试做的工作。

Option Explicit

Function OnlineCurrency(current_country As String, to_country As String) As String
Dim HTTP As MSXML2.XMLHTTP60
Dim URL As String
Dim HTMLDoc As New HTMLDocument
URL = "http://www.google.com/search?q=HKD+to+USD"
Set HTTP = New MSXML2.XMLHTTP60
HTTP.Open "GET", URL, False
HTTP.send
Set HTMLDoc = New HTMLDocument

With HTMLDoc
  .body.innerHTML = HTTP.responseText
  OnlineCurrency = .getElementByClassName("dDoNo vk_bk").innerText
End With

End Function
Run Code Online (Sandbox Code Playgroud)

但似乎我对此无能为力。有人可以帮我/为我指出问题吗?谢谢

html vba xmlhttprequest web-scraping

5
推荐指数
1
解决办法
196
查看次数

标签 统计

html ×1

vba ×1

web-scraping ×1

xmlhttprequest ×1