|
excel宏代码如下:
Sub getSharePrice()
For r = 2 To 100
code_index = 4
out_index = 6
share_code = Cells(r, code_index)
If share_code <> "" Then
share_code_i = Cells(r, code_index).Value
If Val(share_code_i) < 600000 Then
url = "http://qt.gtimg.cn/q=sz" & share_code_i
Else
url = "http://qt.gtimg.cn/q=sh" & share_code_i
End If
With CreateObject("msxml2.xmlhttp")
.Open "GET", url, False
.send
sp = Split(.responsetext, "~")
If UBound(sp) > 3 Then
Cells(r, out_index).Value = sp(3)
Else
Cells(r, out_index).Value = "证券代码错误"
End If
End With
End If
Next
End Sub
|
|