|
楼主 |
发表于 2015-4-17 14:18
|
显示全部楼层
本帖最后由 onlycxb 于 2015-4-18 08:08 编辑
ym123 发表于 2015-4-15 09:23
以下代码只能获取标签为“业绩预告”的年度数据,请教如何获取标签为“分配预告”的数据?谢谢老师指点!
... - Sub test()
- '东方财富网 > 数据中心 > 年报季报 > 2014年年报业绩大全 > 业绩预告 > 分配预告
- 'http://data.eastmoney.com/bbsj/201412/yjyg/3.html
- Dim p, strJS, arr
- Cells.Clear
- With ActiveSheet
- .Cells(1, 1) = "股票代码,股票简称,利润分配预案,公告日期"
- End With
- With CreateObject("Microsoft.XMLHTTP")
- .Open "GET", "http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=SR&sty=FPYA&fd=2014-12-31&st=2&sr=-1&p=1&ps=1&js=(pc),(x)&stat=3&rt=" & Rnd(), False
- .send
- p = Split(.responsetext, ",")(0)
- .Open "GET", "http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=SR&sty=FPYA&fd=2014-12-31&st=2&sr=-1&p=2&ps=" & p & "&js=var%20a={pages:(pc),data:[(x)]}&stat=3&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
复制代码 |
评分
-
1
查看全部评分
-
|