|
楼主 |
发表于 2014-10-31 11:40
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 onlycxb 于 2014-10-31 11:42 编辑
VBA万岁 发表于 2014-10-31 11:26
试过你曾经用过的 encodeURI函数进行转码,不成功。
再尝试吴姐介绍过的多种转码方法,依然失败。
另, ... - Sub 百度地图_北京地铁1号钱()
- Dim url, js, p, slen, i, n
- Set js = CreateObject("scriptcontrol")
- [a2:b20].ClearContents
- js.Language = "jscript"
- For p = 1 To 4
- url = "http://map.baidu.com/"
- url = url & "?newmap=1"
- url = url & "&qt=s"
- url = url & "&c=218"
- url = url & "&wd=北京地铁1号线"
- url = url & "&nn=" & (p - 1) * 10
- url = url & "&ie=utf-8"
- With CreateObject("msxml2.xmlhttp")
- .Open "get", url, False
- .send
- '这里加上了多余的debug.print及unescape函数
- Debug.Print unescape(.responsetext)
-
- js.addcode ("dy= " & .responsetext)
- slen = js.Eval("dy.content.length") - 1
- For i = 0 To slen
- n = n + 1
- Cells(n + 1, 1) = js.Eval("dy.content[" & i & "].name")
- Cells(n + 1, 2) = js.Eval("dy.content[" & i & "].addr")
- Cells(n + 1, 3) = js.Eval("dy.content[" & i & "].alias")
- Next
- End With
- Next
- End Sub
- Function unescape(strTobecoded As String) As String
- With CreateObject("msscriptcontrol.scriptcontrol")
- .Language = "JavaScript"
- unescape = .Eval("unescape('" & strTobecoded & "');")
- End With
- End Function
复制代码 |
|