|
楼主 |
发表于 2014-11-1 20:25
|
显示全部楼层
- Sub 百度北京中学()
- Dim url, js
- [a:c].ClearContents
- br = [{"校名","地址","电话"}]
- Range("a1:c1") = br
- url = ""
- Set js = CreateObject("scriptcontrol")
- js.Language = "jscript"
- For p = 1 To 73
- With CreateObject("msxml2.xmlhttp")
- url = "http://map.baidu.com/?newmap=1"
- url = url & "&reqflag=pcmap"
- url = url & "&biz=1"
- url = url & "&from=webmap"
- url = url & "&qt=s"
- url = url & "&da_src=pcmappg.searchBox.button"
- url = url & "&wd=%E4%B8%AD%E5%AD%A6"
- url = url & "&c=131" '城市代码
- url = url & "&src=0"
- url = url & "&wd2="
- url = url & "&sug=0"
- url = url & "&l=12"
- url = url & "&b=(12925680.97,4809619.72;12990640.97,4842195.72)"
- url = url & "&from=webmap"
- url = url & "&tn=B_NORMAL_MAP"
- url = url & "&nn=" & (p - 1) * 10
- url = url & "&ie=utf-8"
- url = url & "&t=1414824529173"
- .Open "get", url, False
- .send
- js.addcode ("renahu = " & .responsetext)
- slen = js.Eval("renahu.content.length") - 1
- For i = 0 To slen
- n = n + 1
- Cells(n + 1, 1) = js.Eval("renahu.content[" & i & "].name")
- Cells(n + 1, 2) = js.Eval("renahu.content[" & i & "].addr")
- Cells(n + 1, 3) = js.Eval("renahu.content[" & i & "].tel")
- Next
- End With
- Next
- End Sub
复制代码
补充内容 (2014-11-9 14:17):
练习三 |
|