![]() |
#2
古1232020-05-28 21:24
|
只有本站会员才能查看附件,请 登录
![](zzz/editor/img/code.gif)
Sub cha()
Dim tmp() As String, p As Long, xmlhttp As Object, bh$
Dim i As Long
For p = 2 To 3 '此处应该是到几万的(小说名称)
With CreateObject("Msxml2.XMLHTTP")
.Open "get", Cells(p, 1), False
.send
tmp() = Split(StrConv(.responsebody, vbUnicode), ".html"">")
End With
For m = 1 To 5 '此处应该是有几十个(小说章节)
Cells(p, m + 1) = Split(tmp(m), "</a>")(0)
Next m
Next p
End Sub
Dim tmp() As String, p As Long, xmlhttp As Object, bh$
Dim i As Long
For p = 2 To 3 '此处应该是到几万的(小说名称)
With CreateObject("Msxml2.XMLHTTP")
.Open "get", Cells(p, 1), False
.send
tmp() = Split(StrConv(.responsebody, vbUnicode), ".html"">")
End With
For m = 1 To 5 '此处应该是有几十个(小说章节)
Cells(p, m + 1) = Split(tmp(m), "</a>")(0)
Next m
Next p
End Sub
以上是用excel的vba代码实现的,只是举个例子。
所需查询数据时公司内网的,别人连接不上的,就用这个获取小说章节来举例子了。
现实数据有几万个,用VBA感觉太费时间了,都说python速度快,请大神们帮忙给写个代码