- Option Explicit
- Sub Test()
- Dim tmp() As String, i As Long, arr() As String, xmlhttp As Object, N As Long
-
- [A1].CurrentRegion.Clear
- [a1:ae1] = Split("1a,代码,股票名称,昨收,今开,最新价,最高,最低,成交额,成交量,涨跌额,涨跌幅,均价,振幅,委比,委差,现手,内盘,外盘,20t,21u,5分钟涨跌幅,量比,换手,市盈,26z,27aa,28ab,更新时间,30ad,31ae", ",")
-
- Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
- With xmlhttp
- .Open "get", "http://hqdigi2.eastmoney.com/EM_Quote2010NumericApplication/index.aspx?type=s&sortType=C&sortRule=-1&pageSize=5000&page=1&style=33", False
- .send
- tmp() = Split(Split(Split(Replace(.responsetext, """,""", ","), "{rank:[""")(1), """]")(0), ",")
- End With
-
- ReDim arr(UBound(tmp) \ 31, 30)
- For i = 0 To UBound(tmp)
- arr(i \ 31, i Mod 31) = tmp(i)
- Next
- [a2].Resize(UBound(arr, 1) + 1, UBound(arr, 2) + 1) = arr
- [a:ae].Columns.AutoFit
- Union(Columns(1), Columns(20), Columns(21), Columns(26), Columns(27), Columns(28), Columns(30), Columns(31)).ColumnWidth = 0
-
- Erase tmp
- Erase arr
- Set xmlhttp = Nothing
-
- MsgBox "Ok"
- End Sub
复制代码 |