【发布时间】:2017-12-11 22:02:39
【问题描述】:
我想废弃以下 html 代码以从“resultsTable”的“td”标签之一中提取值
我尝试在下面运行 vba 代码,但它不起作用。我收到了
运行时错误代码“91”
Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")
With appIE
.navigate "https://www.investing.com/stock-screener/?
sp=country::5|sector::a|industry::a|equityType::a|exchange::a%3Ceq_market_cap;1"
.Visible = True
End With
Do While appIE.Busy
DoEvents
Loop
Set table = appIE.document.getElementById("resultsContainer").Children(1)
Set tbody = table.getElementsByTagName("tbody")(0)
trs = tbody.getElementsByTagName("tr")
Dim myvalue As String: myvalue = trs.Cells(3).innerText
appIE.Quit
Set appIE = Nothing
MsgBox myvalue
【问题讨论】:
-
哪一行导致错误?
-
嗨,安迪,这行代码是“将 myvalue 作为字符串调暗:myvalue = trs.Cells(3).innerText”