如何用vb提取网页中表格内容
答案:1 悬赏:70 手机版
解决时间 2021-02-22 06:09
- 提问者网友:风月客
- 2021-02-21 15:18
如何用vb提取网页中表格内容
最佳答案
- 五星知识达人网友:山有枢
- 2021-02-21 16:09
Dim Tables As IHTMLElementCollection
Set Tables = WebBrowser2.document.getElementsByTagName("TABLE") '循环出TagName为TABLE的表格元素
Dim Table1 As HTMLTable
For Each Table1 In Tables
If Left(Table1.innerText, 2) = "字段" Then '找出字段中头两个字符是"字段"的表格
Dim Row As HTMLTableRow, Cell As HTMLTableCell
For i = 1 To Table1.rows.length - 1 ' 逐行处理
Set Row = Table1.rows(i)
Row.cells(j).innerText '读取指定列的内容
Next
End If
Next
Set Tables = WebBrowser2.document.getElementsByTagName("TABLE") '循环出TagName为TABLE的表格元素
Dim Table1 As HTMLTable
For Each Table1 In Tables
If Left(Table1.innerText, 2) = "字段" Then '找出字段中头两个字符是"字段"的表格
Dim Row As HTMLTableRow, Cell As HTMLTableCell
For i = 1 To Table1.rows.length - 1 ' 逐行处理
Set Row = Table1.rows(i)
Row.cells(j).innerText '读取指定列的内容
Next
End If
Next
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯