✨星河璀璨✨ th420683
关注数: 22 粉丝数: 105 发帖数: 1,795 关注贴吧数: 42
大佬求帮助,vb引用数据接口,网址带有的日期无法正常使用! 想实现查询2019年3月8日-2018年7月16日股票历名记录,但实现不了http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fq.stock.sohu.com%2FhisHq%3Fcode%3Dcn_002271%26start%3D20180716%26end%3D20500308&urlrefer=1494831cad5b3518a3036365dd8ceaa6" 每次查询的数据只能是这个无后面日期的效果(也是为了避免下标越界的问题才加的日期):http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fq.stock.sohu.com%2FhisHq%3Fcode%3Dcn_002271+&urlrefer=2c8c83fb871ef99631665217a49c1142下文中Format(dm, "000000") 是股票代码 代码如下:Public Sub CommandButton2_Click() Dim Q As Long, dm As String, url As String, sSp() As String For Q = 4 To Range("A1").CurrentRegion.Rows.Count VBA.DoEvents dm = Cells(Q, 1).Value If Val(dm) > 1 Then url = "http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fq.stock.sohu.com%2FhisHq%3Fcode%3Dcn_&urlrefer=2175cc763ddf3bdf0bede614bf48072d" & Format(dm, "000000") & "&start=20180716&end=20500308" Else url = "http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fq.stock.sohu.com%2FhisHq%3Fcode%3Dcn_&urlrefer=2175cc763ddf3bdf0bede614bf48072d" & Format(dm, "000000") & "&start=20180716&end=20500308" End If With CreateObject("msxml2.xmlhttp") .Open "get", url, False .send sSp = Split(.responsetext, """,""") If UBound(sSp) > 1 Then Cells(Q, 3).Value = (sSp(2) - sSp(29)) / sSp(29) * 100 '3日Cells(Q, 4).Value = (sSp(2) - sSp(47)) / sSp(47) * 100 '5日 Cells(Q, 12).Value = (sSp(2) - sSp(542)) / sSp(542) * 100 '60日 Cells(Q, 13).Value = (sSp(2) - sSp(632)) / sSp(632) * 100 '70日 Cells(Q, 14).Value = (sSp(2) - sSp(713)) / sSp(713) * 100 '79日 Else Cells(Q, 3).Value = "无数据" End If End With Next End Sub
1 下一页