下面这段代码是从新浪获取即时数据,是我从网上找到的,但是用VB6运行时提示"用户定义类型未定义",试了几次都不成功,总是提示"无效的内部过程",请高手看看该如何定义呢?
谢谢!!!
'======================================
Sub 获取股票实时价格()
'要求
Dim xmlhttp As MSXML2.XMLHTTP30
Set xmlhttp = New XMLHTTP30
Sheets("资金明细").Select
'Cells.Select
List = "sh000001,sz000001": '股票代码列表,用逗号分开
xmlhttp.Open "GET", "http://hq. + List, False
xmlhttp.send
strs = Split(xmlhttp.responseText, Chr$(10))
indexs = Split(Index, ",")
For i = 1 To UBound(strs) - 1
valueStr = Split(strs(i), ",")
'格式如下:
'0:股票名称,1:今开盘,2:昨收盘,3:当前价,4:最高价,5:高低价,6:买一价,7:卖一价,8:成交量(手),9:成交额(元),
'10:买一量(手),11:买一价,12:买二量(手),13:买二价,14:买三量(手),15:买三价,16:买四量(手),17:买四价,18:买五量(手),19:买五价
'20:卖一量(手),21:卖一价,22:卖二量(手),23:卖二价,24:卖三量(手),25:卖三价,26:卖四量(手),27:卖四价,28:卖五量(手),29:卖五价
'30:交易日期,31:交易时间
'var hq_str_sh601600="中国铝业,23.06,23.15,22.84,23.28,22.50,22.83,22.84,21192649,485084732,5274,22.83,2300,22.82,6600,22.81,54170,22.80,23389,22.79,10500,22.84,1400,22.85,34628,22.86,4400,22.87,18650,22.88,2008-04-11,15:05:33";
'此处可插入处理代码
Next i
End Sub
'======================================