|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub main()
- Dim http As Object, js As Object, strText$, s$
- Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
- http.Open "GET", "http://data.eastmoney.com/bbsj/201806/zcfz.html", False
- http.send: Cells.Clear
- strText = Replace(Replace(Replace(http.responseText, vbCrLf, ""), """", """"), "'", "\'")
- Set js = CreateObject("MSScriptControl.ScriptControl")
- js.Language = "JavaScript": js.AddObject "g", Range("a1")
- s = js.eval("'" & strText & "'.split(/defjson:\s*/)[1].split(/,\s*beforeupdate/)[0];")
- js.eval ("a=" & s & ".data;j=1;for(k in a[0])g(1,j++)=k;for(i=0;i<a.length;i++){j=1;for(k in a[i])g(i+2,j++)=a[i][k];};")
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|