您的位置:首页 > 其它

Excel中读取股票信息的自定义函数

2011-08-19 07:27 162 查看
来源:http://www.minioa.net/office/viewtopic.php?f=3&t=99

Excel中如何读取一个网页

你可以在单元格中使用,比如A2=Stock(A1),其中A1未股票代码,上证后加1,深证后加2,共7位,详情看东方财富网。例如6018181,0000392

Function Stock(cell)
Dim str
Dim arr
Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")
Call objHttp.Open("GET", "http://hqdigi2.eastmoney.com/EM_Quote2010NumericApplication/CompatiblePage.aspx?Type=ZT&jsName=js_fav&fav=" & cell, False)
Call objHttp.setRequestHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)")
Call objHttp.send("")
str = objHttp.ResponseText
arr = Split(str, ",")
Stock = arr(3)
End Function


上述代码不支持代理上网。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: