之前银行外汇牌价的例子,通过网页采集数据
问题:无法采集数据,如何改?
采集按钮代码:
Dim ObjIE As Object
Dim Dom As Object
Dim R As Object
ObjIE = CreateObject("internetexplorer.application")
With ObjIE
.Navigate("http://www.boc.cn/sourcedb/whpj",True)
Do While .ReadyState <> 4
Application.DoEvents
Loop
Dom = .Document
StatusBar.Message1=" 正在采集,请稍候.... "
R = Dom.All.tags("table")(7).Rows
Dim Tbl As Table = Tables("外汇牌价分析表")
For i As Integer = 1 To R.Length-1
Dim TmpRow As Row = Tbl.AddNew
For j As Integer = 0 To R(i).Cells.Length - 1
TmpRow(Tbl.Cols(j).Name) = R(i).Cells(j).innerText
Next
Next
Tbl.AutoSizeCols
.quit
End With
StatusBar.Message1=" 采集完成 "
运行到:
R = Dom.All.tags("table")(7).Rows
就报错:
未设置对象变量或 With 块变量。
.NET Framework 版本:2.0.50727.3655
Foxtable 版本:2014.9.19.1
错误所在事件:窗口,数据采集,Button2,Click
详细错误信息:
未设置对象变量或 With 块变量。