|
周末了,闲来无事,写一个吧!!!- Sub main()
- Dim strText$, arrData(1 To 6000, 1 To 4), i&, n&, j&
- Sheets(1).Select: Sheets(1).Cells.Clear: Sheets(1).Range("a:d").NumberFormat = "@"
- Sheets(1).[A1:D1] = [{"股份代号","股份名称","于中央结算系统的持股量","占于上交所上市及交易的A股总数的百分比"}]
- With CreateObject("msxml2.xmlhttp")
- .Open "GET", "http://sc.hkexnews.hk/TuniS/www.hkexnews.hk/sdw/search/mutualmarket_c.aspx?t=sh", False
- .send
- Do While .readyState <> 4
- DoEvents
- Loop
- strText = .responseText
- End With
- With CreateObject("htmlfile")
- .write strText
- For Each TR In .all.tags("table")(2).Rows
- i = i + 1: j = 0
- If i >= 3 Then
- n = n + 1
- For Each TD In TR.Cells
- j = j + 1
- arrData(n, j) = TD.innerText
- Next
- End If
- Next
- End With
- Sheets(1).Range("a2").Resize(n, 4) = arrData
- End Sub
复制代码
|
|