|
楼主 |
发表于 2020-12-7 01:25
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
能获取到数据了,但只能获取第一个单元格的数据。。。
- Dim xmlhttp As Object, json As Object
- Dim strUrl As String
- Dim intI As Integer
- Set xmlhttp = CreateObject("msxml2.xmlhttp")
- Set json = CreateObject("msscriptcontrol.scriptcontrol")
- For intI = 4 To Range("A65536").End(xlUp).Row
- strUrl = "http://f10.eastmoney.com/PC_HSF10/NewFinanceAnalysis/MainTargetAjax?type=0&code=" & Trim(Range("A" & intI).Value)
- With xmlhttp
- xmlhttp.Open "GET", strUrl, False
- xmlhttp.send
- With json
- .Language = "jscript"
- .addcode "var mydata=" & xmlhttp.responsetext
- Set json = .codeobject.mydata
- End With
-
- Cells(intI, arrSrartColumn + 11) = CallByName(CallByName(json, "0", VbGet), "jbmgsy", VbGet) '基本每股收益
- Cells(intI, arrSrartColumn + 12) = CallByName(CallByName(json, "0", VbGet), "kfjlr", VbGet) '扣非净利润
- Cells(intI, arrSrartColumn + 13) = CallByName(CallByName(json, "0", VbGet), "zcfzl", VbGet) '资产负债率
- End With
- Next
复制代码
|
|