|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
根据楼主的代码,我修改如下,已经可以了,谢谢!
Sub test()
Dim strJs, P, arr, i
Cells.ClearContents
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", "http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=SR&sty=SZBL&fd=2014-12-31&st=2&sr=-1&p=1&ps=1&js=(pc),(x)", False
.send
P = Split(.responsetext, ",")(0)
.Open "GET", "http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=SR&sty=SZBL&fd=2014-12-31&st=2&sr=-1&p=1&ps=" & P & "&js=var%20a={pages:(pc),data:[(x)]}", 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"), Comma:=True
End With
Cells(1, 1).Resize(1, UBound(arr) + 1) = Array("股票代码", "股票简称", "利润分配 ", "送转比例", "现金分红", "每股收益(元)", "每股未分配利润(元)", "每股未分配利润(元)", "上期每股未分配利润(元) ", "上期每股资本公积金(元)", "股权登记日", "公告日期")
i = Sheet5.[a65535].End(xlUp).Row
Worksheets("Sheet5").Range("A2:M" & i).Copy _
Destination:=Worksheets("Sheet1").Range("B3")
End Sub
|
|