|

楼主 |
发表于 2015-4-30 12:30
|
显示全部楼层
jinsha2002 发表于 2015-4-29 21:37 
onlycxb 老师,这种网上数据能下不,
能
Sub t()
Dim html As Object, Db As Object, strText As String
Dim m As Integer, P As Integer, a, i, arr(1 To 10000, 1 To 5)
P = 100 '页面显示100条记录
Set html = CreateObject("htmlfile")
With CreateObject("msxml2.xmlhttp")
.Open "GET", "http://www.55188.com/viewthread.php?tid=6889051&ajaxlist=5&begin=0&nowtime=1430363466&loop=" & P & "&_=1430363474688", False
.send
strText = Replace(.responsetext, "tbody", "li")
html.body.innerhtml = strText
End With
Set Db = html.all.tags("li")
For Each a In Db
m = m + 1
For i = 0 To a.Children.Length - 1
'测试各要素
'Debug.Print "[" & i & "]__" & a.Children(i).innertext
'[0]__
'[1]__
'[2]__1
'[3]__
'[4]__
'[5]__风云2677
'[6]__
'[7]__
'[8]__SH600026
'[9]__
'[10]__
'[11]__中海发展
'[12]__
'[13]__
'[14]__
'[15]__
'[16]__横有多长,竖有多高。拉升刚刚开始。
'[17]__
'[18]__
'将各要素保存
arr(m, 1) = a.Children(2).innertext '序号
arr(m, 2) = a.Children(5).innertext
arr(m, 3) = a.Children(8).innertext
arr(m, 4) = a.Children(11).innertext
arr(m, 5) = a.Children(16).innertext
Next i
Next a
Cells.Clear
[a2].Resize(m, UBound(arr, 2)) = arr
End Sub |
|