|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 俊锋伍贰零 于 2015-8-21 06:58 编辑
Sub 中金所选取自定义数据()
Dim arrEM(1 To 16), arrEMname
Dim arrData(1000, 1 To 16)
Dim i As Long, j As Long
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "http://www.cffex.com.cn/fzjy/mrhq/201508/11/index.xml", False
.Send
arrEMname = Array(, "instrumentid", "tradingday", "openprice", "highestprice", "lowestprice", "closeprice", "openinterest", "presettlementprice", "settlementpriceIF", "settlementprice", "volume", "turnover", "expiredate", "productid", "delta", "segma")
With .responseXML
For i = 1 To 16
Set arrEM(i) = .getElementsByTagName(arrEMname(i))
Next
For i = 0 To arrEM(1).Length - 1
For j = 1 To 16
arrData(i, j) = arrEM(j)(i).Text
Next
Next
End With
End With
Cells.Clear
Range("a1:p1").Value = Array("合约名称", "交易日期", "开", "高", "低", "收", "总持仓量", "", "", "今结算", "成交量", "成交金额", "交割日", "", "", "")
Range("a2").Resize(i, 16).Value = arrData
End Sub
能不能实现按单品种的所有交易日的数据形成一个表
O(∩_∩)O谢谢
还有一问:成交额如何显示亿元,/100000000加到哪里呢?……
|
|