我想从网页中提取值,我必须进行多次输入和点击,然后才能获取所需的数据,因此直到选择完所有搜索参数后,我才想进行抓取。
我需要对象后的值,并在更改搜索/缩小范围后进行导航。我创建了一个模块,加载了Internet控件等,所有这些都可以正常工作,页面加载也是如此。加载后,我更改了页面上的搜索参数,并获得了更新的结果,然后我想提取这些值。任何帮助将不胜感激...。
涉及的更新代码:
我正在尝试使用shdocvw.internetexplorer
Sub PULLDATA()
Dim IE As Object
Dim ieObj As InternetExplorer
Dim htmlEle As IHTMLElement
Dim i As Integer
Set IE = GetIE("'URL Hidden")
' initialize i to one
i = 2
For Each htmlEle In IE.document.getElementsByClassName("number") (0).getElementsByTagName("li")
With ActiveSheet
.Range("B" & i).Value = htmlEle.Children(0).textContent
.Range("C" & i).Value = htmlEle.Children(1).textContent
.Range("D" & i).Value = htmlEle.Children(2).textContent
.Range("E" & i).Value = htmlEle.Children(3).textContent
.Range("F" & i).Value = htmlEle.Children(4).textContent
End With
i = i + 1
Next htmlEle
End Sub
.Quit
End With
Set ie = Nothing
End Sub
我刚刚开始构建它,但是骨头在这里
我只需要澄清一下,肯定有人有一个基本代码来向工作表中添加元素,而不是自动执行然后检索值...我确定在检查完页面上的各种过滤器后才能做到这一点包含类和div,并更新了我必须做的页面手动,并且可以在工作簿中填充特定工作表