Excel VBA获取网页内容

 时间:2026-02-15 15:40:14

1、Function getWebString(sUrl As String)Dim HttpReq As ObjectSet HttpReq = CreateObject("MSXML2.ServerXMLHTTP")HttpReq.Open "GET", sUrl, FalseHttpReq.sendgetWebString = HttpReq.responseTextEnd Function

2、可以在表格里面以公式的形式来使用,如

=getWebString("https://www.baidu.com/s?wd=cc")

就可以得到指定页面的源码数据了

  • VBA代码-Excel 选中单元格区域并复制
  • Excel怎么自动加载宏,Excel宏怎么自动运行
  • Excel VBA代码执行的几种常用方式
  • Excel中如何设置简码输入
  • excel中vba函数inputbox的使用方法详解
  • 热门搜索
    干煸茧蛹的做法 重庆火锅做法 猝怎么读 咸肉的做法大全 钵怎么读 鲍鱼炖土豆的做法 蛋糕卷的做法 正宗糖醋排骨的做法 攸怎么读 70年产权到期怎么办