oliwa wrote:
如下是騰訊的收盤價 , 想要把它全部轉出來使用 , 謝謝 !!
https://stockapp.finance.qq.com/mstats/#mod=list&id=ssa&module=SS&type=ranka
就如mickmini(1030樓),說的一樣,資料來源網址是https://qt.gtimg.cn/
Sub qq()
Dim Xmlhttp As Object, Url As String, StockName As String, stock, temp, i As Integer, r As Long
Set Xmlhttp = CreateObject("msxml2.xmlhttp")
Cells.Clear
Application.ScreenUpdating = False
Range("a1:m1") = Array("代碼", "名稱", "最新價", "漲跌幅", "漲跌額", "買入", "賣出", "成交量", "成交額", "今開", "昨收", "最高", "最低")
'StockName = "sh688700" 'test
'StockName = "sh688700,sh688609" 'test
StockName = "sh688700,sh603529,sh605259,sz300134,sz300076,sz300649,sz300235,sh688579"
'股票代碼用,(逗點)區隔,不確定是否能一次查詢超過80筆,請自行測試
'如果代碼數量太多,建議改用迴圈處理
Url = "https://qt.gtimg.cn/q=" & StockName
With Xmlhttp
.Open "GET", Url, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "Cache-Control", "no-cache"
.setRequestHeader "Pragma", "no-cache"
.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
.send
stock = Split(.Responsetext, ";")
r = 1
For i = 0 To UBound(stock) - 1
temp = Split(stock(i), "~")
r = r + 1
Cells(r, 1) = temp(2)
Cells(r, 2) = temp(1)
Cells(r, 3) = temp(3)
Cells(r, 4) = temp(32) & "%"
Cells(r, 5) = temp(31)
Cells(r, 6) = temp(19)
Cells(r, 7) = temp(3)
Cells(r, 8) = temp(36)
Cells(r, 9) = temp(37)
Cells(r, 10) = temp(5)
Cells(r, 11) = temp(4)
Cells(r, 12) = temp(33)
Cells(r, 13) = temp(34)
Next i
End With
Cells.EntireColumn.AutoFit
Application.ScreenUpdating = True
Set Xmlhttp = Nothing
End Sub
































































































