|
本帖最后由 tsmcp 于 2018-9-16 13:13 编辑
请教各位老师,网页http://sc.hkexnews.hk/TuniS/www.hkexnews.hk/sdw/search/mutualmarket_c.aspx?t=sh有日期控件,我想抓取其他日期数据,应如何处理呢?谢谢。
在此非常感谢duquancai老师及ccwan老师。
Private Sub CommandButton1_Click()
Dim strText$, arrData(1 To 6000, 1 To 4), i&, n&, j&
Dim r As Variant
Range("A2:P" & [A65536].End(xlUp).Row + 1).ClearContents
For p = 2 To 2
On Error Resume Next
With CreateObject("internetexplorer.application")
.Visible = False
.Navigate "http://sc.hkexnews.hk/TuniS/www.hkexnews.hk/sdw/search/mutualmarket_c.aspx?t=sh"
Do Until .ReadyState = 4
DoEvents
Loop
.Document.all.tags("select")(0).Value = "12"
.Document.all.tags("select")(1).Value = "09
.Document.all.tags("select")(2).Value = "2018"
.Document.all.tags("INPUT")(6).Click
.Document.submit
t = Timer
Do While .busy Or t + 3 > Timer
DoEvents
Loop
For Each TR In .Document.all.tags("table")(15).Rows
i = i + 1: j = 0
If i >= 3 Then
n = n + 1
For Each TD In TR.Cells
j = j + 1
arrData(n, j) = TD.innerText
Next
End If
Next
End With
Next p
Sheets(1).Range("a2").Resize(n, 4) = arrData
End Sub
|
|