|
楼主 |
发表于 2014-10-14 19:16
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 onlycxb 于 2014-10-14 19:18 编辑
分享5:阳光私募净值
后期数据处理过程请自学者自行完善。- Sub test()
- Dim xml As New MSXML2.XMLHTTP, St As String, Url As String
- Dim VIEWSTATE As String, 页码%, 总页数%
- Url = "http://www.go-goal.com/data/trust"
- With xml
- .Open "GET", Url, False
- .send
- 总页数 = Split(Split(.responseText, "')"" style=""margin-right:5px;"">末页")(0), "下一页</a><a class=""f12bc"" href=""javascript:__doPostBack('pager','")(1)
- VIEWSTATE = Split(Split(.responseText, "VIEWSTATE"" value=""")(1), """ />")(0)
- VIEWSTATE = encodeURI(VIEWSTATE)
- For 页码 = 1 To 总页数
- .Open "POST", Url, False
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .send "__EVENTTARGET=pager&__EVENTARGUMENT=1&__LASTFOCUS=&__VIEWSTATE=" & VIEWSTATE & "&ddlFoundationDateOperater=1&txtFoundationDate=&ddlTrustCompany=1&chklFundStatus%240=on&ddlStatisticDateOperater=1&txtStatisticDate=&ddlFundManager=1&radlStatisticMode=1&ddlNProv=0&ddlNCity=0&hidden1=&hidden2=False&hidDefaultYear=2014&pager_input=2"
- St = Split(Split(.responseText, "<div class=""bdb1"">")(1), "</div>")(0)
- St = Replace(Replace(St, vbCrLf, ""), "<td align=""center"">", "")
- St = Replace(St, "<td align=""right""> ", "")
- St = Replace(St, " ", "")
- St = Replace(St, "</a>", "")
- Dim arr
- arr = Split(St, "<li>")
- '.....字符及数据处理省略......
- Stop
- Next
- End With
- End Sub
- Public Function encodeURI(ByVal strText As String) As String
- With CreateObject("msscriptcontrol.scriptcontrol")
- .Language = "JavaScript"
- encodeURI = .Eval("encodeURIComponent('" & strText & "');")
- End With
- End Function
复制代码 |
评分
-
1
查看全部评分
-
|