|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
求助:为何2014年预报中的业绩变动原因数据不能抓取?
Sub test2()
'东方财富网 > 数据中心 > 年报季报 > 2014年年报业绩大全 > 业绩预告 > 业绩预告 (http://data.eastmoney.com/bbsj/201412/yjyg.html)
With ActiveSheet
.Cells(1, 1) = "股票代码,股票简称,业绩变动,业绩变动幅度,预告类型,上年同期净利润(万元),预告类型,公告日期,报告期,上年同期净利润(万元),预告业绩变动幅度均值,净利润,预告利润均值,新公布"
' .Cells(1, 1) = "股票代码,股票简称,业绩变动,业绩变动幅度,业绩变动原因,预告类型,上年同期净利润(万元),预告类型,公告日期,报告期,上年同期净利润(万元),预告业绩变动幅度均值,净利润,预告利润均值,新公布"
End With
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", "http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=SR&sty=YJYG&fd=2014-12-31&st=4&sr=-1&p=1&ps=1&js=(pc),(x)&stat=0&rt=" & Rnd, False
.send
P = Split(.responsetext, ",")(0)
.Open "GET", "http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=SR&sty=YJYG&fd=2014-12-31&st=4&sr=-1&p=1&ps=" & P & "&js=var%20a={pages:(pc),data:[(x)]}&stat=0&rt=" & Rnd, False
.send
strJs = .responsetext & ";var b=a.data;var s=''; for(x in b){s+=b[x]+'\r';}"
End With
With CreateObject("MSScriptControl.ScriptControl")
.Language = "javascript"
strJs = .Eval(strJs)
End With
Arr = Split(strJs, vbCr)
With ActiveSheet
.[a2].Resize(UBound(Arr)) = WorksheetFunction.Transpose(Arr)
.[a:a].TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, Comma:=True, FieldInfo:=Array(1, 2)
End With
End Sub
|
|