|
发表于 2016-8-31 14:25
|
显示全部楼层
本楼为最佳答案
- Sub aa()
- Dim html As Object, uls As Object, ul As Object, li As Object, div As Object
- Dim i As Integer, j As Integer, arr(1 To 100, 1 To 5)
- Const url As String = "http://q1.sto.cn/chaxun/result?express_no=402059104241"
- Dim str As String
- With CreateObject("winhttp.winhttprequest.5.1")
- .Open "GET", url, False
- .send
- Set html = CreateObject("htmlfile")
- html.body.innerhtml = .responseText
- Set uls = html.all.tags("ul")
- For Each ul In uls
- If ul.classname = "result-list-info" Then
- For i = 2 To ul.Children.Length - 1
- Set li = ul.Children(i)
- For j = 0 To li.Children.Length - 1
- arr(i - 1, j + 1) = li.Children(j).innertext
- Next
- Next
- End If
- Next
- End With
- Range("a1").Resize(i - 1, 2) = arr
- End Sub
-
复制代码 |
|