|
楼主 |
发表于 2015-5-12 20:59
|
显示全部楼层
本帖最后由 zhusong19989 于 2015-5-12 21:16 编辑
Option Explicit
Sub test()
Dim HTML, tb, i&, j&, x&, n&, s$
[a2:d9999] = ""
Set HTML = CreateObject("htmlfile")
With CreateObject("msxml2.xmlhttp")
For x = 0 To 21
.Open "get", "https:(省去双//)gaokao.chsi.com.cn/zzbm/mdgs/detail.action?oid=476733949&lx=" & 30 * x, False
.Send
Application.Wait (Now + TimeValue("00:00:02"))
HTML.body.innerhtml = .responsetext
Set tb = HTML.ALL.tags("table")(0).Rows
For i = 1 To tb.Length - 1
n = n + 1
For j = 0 To tb(i).Cells.Length - 1
Cells(n + 1, j + 1) = tb(i).Cells(j).innertext
Next
Next
Next
End With
MsgBox "获取完毕!"
End Sub
Option Explicit
这个是我改后的,导入后就是重复的。 |
|