liuzhengdao

来源: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

上述代码不支持代理上网。

分类:

技术点:

相关文章:

  • 2021-12-26
  • 2021-12-25
  • 2021-12-10
  • 2021-11-19
  • 2021-07-22
  • 2022-02-07
  • 2021-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-29
  • 2022-02-22
  • 2021-12-30
  • 2022-01-24
相关资源
相似解决方案