ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: 五指山888

[求助] 求助抓取新浪行情

[复制链接]

TA的精华主题

TA的得分主题

发表于 2016-10-5 20:21 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
YZC51 发表于 2016-10-4 17:18
FenLie
修改为
Call FenLie

您好!
我抓到的网址“http://ewealth.abchina.com/app/data/api/DataService/GoldInfoV2”一打开就是下载JSON文件,怎么办?

TA的精华主题

TA的得分主题

发表于 2016-10-6 10:31 | 显示全部楼层
YZC51 发表于 2016-9-20 10:58
找到原因啦!添加XML引用即可,3.0、4.0、5.0、6.0都行!

{"Data":{"Table":[{"ProdCode":"Ag(T+D)","CurrentPrice":"4210.00","UpLowDirection":"0","UpLowRate":"-0.38%","SuccessAmount":"4654558","OpenPrice":"4221.00","YesterdayPrice":"4228.00","HighestPrice":"4245.00","LowestPrice":"4190.00","Kind":"001DZYH","UpdateTime":"2016-09-30 15:45:00","ShowOrder":"1","BuyUrl":"http://ewealth.abchina.com/Gold/client/201501/t20150109_661266.htm"},{"ProdCode":"Au(T+D)","CurrentPrice":"284.80","UpLowDirection":"0","UpLowRate":"0.09%","SuccessAmount":"48292","OpenPrice":"283.92","YesterdayPrice":"284.38","HighestPrice":"284.94","LowestPrice":"283.20","Kind":"001DZYH","UpdateTime":"2016-09-30 15:45:00","ShowOrder":"2","BuyUrl":"http://ewealth.abchina.com/Gold/client/201501/t20150109_661266.htm"},{"ProdCode":"Au(T+N1)","CurrentPrice":"286.25","UpLowDirection":"0","UpLowRate":"-0.43%","SuccessAmount":"80366","OpenPrice":"287.50","YesterdayPrice":"287.55","HighestPrice":"287.90","LowestPrice":"286.25","Kind":"001DZYH","UpdateTime":"2016-09-30 15:45:00","ShowOrder":"3","BuyUrl":"http://ewealth.abchina.com/Gold/client/201501/t20150109_661266.htm"},{"ProdCode":"Au(T+N2)","CurrentPrice":"284.90","UpLowDirection":"0","UpLowRate":"0.04%","SuccessAmount":"82000","OpenPrice":"284.30","YesterdayPrice":"284.65","HighestPrice":"286.50","LowestPrice":"284.10","Kind":"001DZYH","UpdateTime":"2016-09-30 15:45:00","ShowOrder":"4","BuyUrl":"http://ewealth.abchina.com/Gold/client/201501/t20150109_661266.htm"},{"ProdCode":"mAu(T+D)","CurrentPrice":"284.99","UpLowDirection":"0","UpLowRate":"0.09%","SuccessAmount":"44768","OpenPrice":"284.11","YesterdayPrice":"284.51","HighestPrice":"285.05","LowestPrice":"283.50","Kind":"001DZYH","UpdateTime":"2016-09-30 15:45:00","ShowOrder":"5","BuyUrl":"http://ewealth.abchina.com/Gold/client/201501/t20150109_661266.htm"},{"ProdCode":"Au100g","CurrentPrice":"285.00","UpLowDirection":"0","UpLowRate":"0.18%","SuccessAmount":"162","OpenPrice":"284.50","YesterdayPrice":"284.50","HighestPrice":"286.49","LowestPrice":"284.50","Kind":"002DZYH","UpdateTime":"2016-09-30 15:45:00","ShowOrder":"6","BuyUrl":"http://ewealth.abchina.com/Gold/client/201501/t20150109_661266.htm"},{"ProdCode":"Au99.95","CurrentPrice":"284.69","UpLowDirection":"0","UpLowRate":"0.30%","SuccessAmount":"1490","OpenPrice":"284.00","YesterdayPrice":"283.84","HighestPrice":"285.00","LowestPrice":"283.80","Kind":"002DZYH","UpdateTime":"2016-09-30 15:45:00","ShowOrder":"7","BuyUrl":"http://ewealth.abchina.com/Gold/client/201501/t20150109_661266.htm"},{"ProdCode":"Au99.99","CurrentPrice":"284.95","UpLowDirection":"0","UpLowRate":"0.14%","SuccessAmount":"833860","OpenPrice":"284.99","YesterdayPrice":"284.54","HighestPrice":"285.20","LowestPrice":"283.01","Kind":"002DZYH","UpdateTime":"2016-09-30 15:45:00","ShowOrder":"8","BuyUrl":"http://ewealth.abchina.com/Gold/client/201501/t20150109_661266.htm"}],"Table1":[{"ProdCode":"9101","ProdName":"人民币账户黄金","UpLowDirection":"0","CustomerSell":"272.79","CustomerBuy":"273.29","LowSell":"271.44","HighBuy":"274.22","UpdateTime":"2016-10-05 20:13:40","ShowOrder":"1","BasePrice":"273.960000","CurrentPrice":"273.040000","BuyUrl":""},{"ProdCode":"9201","ProdName":"人民币账户白银","UpLowDirection":"0","CustomerSell":"3.82","CustomerBuy":"3.84","LowSell":"3.79","HighBuy":"3.89","UpdateTime":"2016-10-05 20:13:38","ShowOrder":"2","BasePrice":"3.880000","CurrentPrice":"3.830000","BuyUrl":""},{"ProdCode":"9114","ProdName":"美元账户黄金","UpLowDirection":"0","CustomerSell":"1271.18","CustomerBuy":"1274.18","LowSell":"1265.32","HighBuy":"1278.95","UpdateTime":"2016-10-05 20:13:40","ShowOrder":"3","BasePrice":"1277.400000","CurrentPrice":"1272.680000","BuyUrl":""},{"ProdCode":"9214","ProdName":"美元账户白银","UpLowDirection":"0","CustomerSell":"17.79","CustomerBuy":"17.94","LowSell":"17.65","HighBuy":"18.17","UpdateTime":"2016-10-05 20:13:38","ShowOrder":"4","BasePrice":"18.085000","CurrentPrice":"17.865000","BuyUrl":""}]},"ErrorCode":"0","ErrorMsg":"","Url":null}

这是得到的JSON,可以帮我解释一下吗,我用For Each aa1 In CallByName(objJSON, "Date", VbGet)
来循环,老是报错。。。。

TA的精华主题

TA的得分主题

 楼主| 发表于 2016-10-26 19:31 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
YZC51 发表于 2016-10-4 17:18
FenLie
修改为
Call FenLie

谢谢老师,FenLie上面一行 Range("b2:b" & (UBound(arr) + 2)) = Application.Transpose(arr)就卡住了

TA的精华主题

TA的得分主题

 楼主| 发表于 2017-5-1 15:58 | 显示全部楼层
002837        英维克,过了节买吧
给关心本贴的各位推荐,第一次,建议各位关注一下,不必实际买入,免得不必要损失。

TA的精华主题

TA的得分主题

 楼主| 发表于 2017-9-16 22:25 | 显示全部楼层
五指山888 发表于 2016-10-26 19:31
谢谢老师,FenLie上面一行 Range("b2:b" & (UBound(arr) + 2)) = Application.Transpose(arr)就卡住了

能不能帮忙解决吗,为啥卡住了

TA的精华主题

TA的得分主题

 楼主| 发表于 2017-9-16 22:27 | 显示全部楼层

为啥这个软件不能在2003版下运行?请老师们出手帮下忙解决吧

TA的精华主题

TA的得分主题

发表于 2017-9-18 19:18 | 显示全部楼层
五指山888 发表于 2017-9-16 22:27
为啥这个软件不能在2003版下运行?请老师们出手帮下忙解决吧

来啦
Sub 沪深A股3()
    URL = "http://hqdigi2.eastmoney.com/EM_Quote2010NumericApplication/index.aspx?type=s&sortType=C&sortRule=-1&pageSize=3500&page=1&jsName=quote_123&style=33&_g=" ' & Rnd()
    With CreateObject("Msxml2.XMLHTTP") 'CreateObject("Microsoft.XMLHTTP")
            .Open "GET", URL, False
            .Send
            v = .responseText
    End With
   
    strText = Split(Split(v, "[""")(1), """]")(0)
   
    Cells.ClearContents
    Dim ar() As String
   
    ar = Split(strText, """,""")
    Dim arr(0 To 10000, 0)
    For i = 0 To UBound(ar)
        arr(i, 0) = ar(i)
    Next
    Range("b2:b" & (UBound(arr) + 2)) = arr
    Call FenLie
    [a2] = 1: [a3] = 2: [a2:a3].AutoFill Range("a2:a" & UBound(ar) + 2)
    [a1:AA1] = Split("序号 代码 名称 昨收 今开 最新价 最高 最低 金额 总手 涨跌额 涨跌幅 均价 振幅% 委比% 委差 现手   量比 换手% 市盈率 买入 更新时间 流通股本 流通市值 流通市值")
End Sub

TA的精华主题

TA的得分主题

发表于 2017-9-18 22:11 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
或者这样
Sub 沪深A股()
    URL = 同上
    With CreateObject("Msxml2.XMLHTTP") 'CreateObject("Microsoft.XMLHTTP")
            .Open "GET", URL, False
            .Send
            v = .responseText
    End With
   
    strText = Replace(Replace(Split(Split(v, "[""")(1), """]")(0), """,""", "||"), ",", vbTab)
   
    Cells.ClearContents
   
    Dim arr() As String
    arr = Split(strText, "||")
    [a2] = 1: [a3] = 2: [a2:a3].AutoFill Range("a2:a" & UBound(arr) + 2)
    [a1:AA1] = Split("序号 代码 名称 昨收 今开 最新价 最高 最低 金额 总手 涨跌额 涨跌幅 均价 振幅% 委比% 委差 现手   量比 换手% 市盈率 买入 更新时间 流通股本 流通市值 流通市值")
    Call XieRu(arr, [b2])

End Sub

Public Sub XieRu(a, R As Range)
'a:待写入数组;R:写入起始位置
Dim d As Object
Set d = New DataObject
d.SetText Join(a, vbLf)
d.PutInClipboard
R.Select
ActiveSheet.Paste
Set d = Nothing
End Sub

TA的精华主题

TA的得分主题

发表于 2017-9-18 22:12 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
DataObject 要引用microsort forms 2.0,增加一个窗体就自动引用了。没有引用是出现未定义类型!

TA的精华主题

TA的得分主题

发表于 2017-9-18 22:31 | 显示全部楼层
请看附件
沪深A股.rar (17.16 KB, 下载次数: 61)

评分

1

查看全部评分

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-11-20 20:26 , Processed in 0.044710 second(s), 7 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表