|
大师,下面代码中的这一句 strJs = .responsetext & ";var b=a.data;var s=''; for(x in b){s+=b[x]+'\r';}"什么意思,能否作个注释?网上没地方有说明。另外, strJs = .responsetext & ";这里的;有时是:,怎么回事呢?谢了。
Sub test()
Dim strJs, P
Cells.ClearContents
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", "http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=SR&sty=YJBB&fd=2014-12-31&st=13&sr=-1&p=1&ps=1&js=(pc),(x)&stat=0&rt=47601296", False
.send
P = Split(.responsetext, ",")(0)
.Open "GET", "http://datainterface.eastmoney.com/EM_DataCenter/JS.aspx?type=SR&sty=YJBB&fd=2014-12-31&st=13&sr=-1&p=1&ps=" & P & "&js=var%20a={pages:(pc),data:[(x)]}&stat=0&rt=47601296", False
.send
CopyToClipbox .responsetext
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
End Sub
|
|