|
楼主 |
发表于 2015-9-19 10:26
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
网页有改版,新的代码如下:
- Sub 天气2()
- Dim js, dy1, dy2, t$
- With CreateObject("WinHttp.WinHttpRequest.5.1")
- .Open "GET", "http://d1.weather.com.cn/dingzhi/101281801.html?_=" & Rnd(), False
- .SetRequestHeader "Referer", "http://www.weather.com.cn/weather1d/101281801.shtml"
- .send
- t = .ResponseText
- Debug.Print t
- End With
- Set js = CreateObject("MSScriptControl.ScriptControl")
- With js
- .Language = "javascript"
- .AddCode (t)
- Set dy2 = .Eval("cityDZ101281801.weatherinfo")
- MsgBox dy2.cityname & Chr(10) & "最低气温:" & dy2.tempn & Chr(10) & "最高气温:" & dy2.temp & Chr(10) & "风力:" & dy2.ws
- End With
- End Sub
复制代码 |
|