何必要加密呢?
源码在此:
Sub 美股()
Dim dm$, txt$, h%, l%, sj, bl, http As Object
t = Timer
ar = Sheet1.Range("a2:" & Sheet1.Cells(Rows.Count, 1).End(xlUp).Address)
dm = Join(Application.Transpose(ar), "7,")
URL = "http://nufm.dfcfw.com/EM_Finance2014NumericApplication/JS.aspx?type=CT&cmd=" & dm & "7&sty=DUNFIM&st=z&sr=&p=&ps=&lvl=&cb=BaseQuote&js=&token=44c9d251add88e27b65ed86506f6e5da"
ar = Array(2, 3, 5, 6, 7, 8, 9, 11, 27)
Set http = CreateObject("Microsoft.XMLHttp")
With http
.Open "GET", URL, False
.Send
txt = .ResponseText
End With
Debug.Print txt
txt = Mid(txt, 13, Len(txt) - 15)
arr = Split(txt, """,""")
ReDim arr2(1 To UBound(arr) + 1, 1 To UBound(ar) + 1)
For Each sj In arr
h = h + 1
arr1 = Split(sj, ",")
For Each bl In ar
l = l + 1
arr2(h, l) = arr1(bl)
Next
l = 0
Next
Sheet1.[b2].Resize(UBound(arr2), UBound(arr2, 2)) = arr2
Sheet1.[a1:j1] = Array("代码", "中文名", "现价", "涨幅", "今开", "昨收", "最高", "最低", "市盈率", "时间")
Set win = Nothing
MsgBox ("更新用时" & Timer - t & "秒!")
End Sub
|