Excel | 运用VBA提取网页数据的一个实例 | 网页,数据,信息,提取,基金
2018-09-22
本帖最后由 2339083510 于 2017-2-10 14:43 编辑
http://www.exceltip.net/thread-42824-1-1.html
非常感谢分享,研究你的帖子,我也大致上搞懂了excel采数据的一些思路,不过你的代码太复杂,我也写了一个,简化了一些(包含链接就发不出来,这个自己把"”%%%%%%%%%%%%%%%%%%"替换为链接就行了)
Sub 运用VBA提取网页的基金信息到Excel工作表中()
On Error GoTo ErrorHandler
Dim re As Object, srg$, pos1%, pos2%, i%, j%
Dim arr() As String, brr() As String, crr() As String, Rst(1 To 10000, 1 To 13)
Application.ScreenUpdating = False
"下载数据
With CreateObject("Microsoft.XMLHTTP")
.Open "get", "%%%%%%%%%%%%%%%%%%", False
.send
srg = .responsetext
End With
"提取标题
pos1 = InStr(srg, "") + Len("")
pos2 = InStr(srg, "
")arr = Split(Mid(srg, po