|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 onlycxb 于 2015-4-9 17:57 编辑
- Sub 百度地图搜索()
- Dim objson As Object, StrJs As String, url As String, p
- Cells.Clear
- [a1:c1] = [{"店名","地址","电话"}]
- Set objson = CreateObject("scriptcontrol")
- objson.Language = "javascript"
- For p = 1 To 10
- url = "http://map.baidu.com/?newmap=1"
- url = url & "&reqflag=pcmap"
- url = url & "&biz=1"
- url = url & "&pcevaname=pc2"
- url = url & "&da_par=direct"
- url = url & "&from=webmap"
- url = url & "&qt=s"
- url = url & "&from=webmap"
- url = url & "&c=319,+"
- url = url & "&wd=餐饮"
- url = url & "&pn=" & p - 1
- url = url & "&db=0"
- url = url & "&sug=0"
- url = url & "&da_src=pcmappg.poi.page"
- url = url & "&on_gel=1"
- url = url & "&src=7"
- url = url & "&gr=3"
- url = url & "&l=13"
- url = url & "&addr=0"
- url = url & "&nn=" & (p - 1) * 10
- url = url & "&ie=utf-8"
- url = url & "&t=1428490938134"
- With CreateObject("msxml2.xmlhttp")
- .Open "GET", url, False
- .send
- StrJs = "var a=" & .responsetext & ";var s=''; for(x in a.content){ s+=a.content[x].name+'\t'+a.content[x].addr+'\t'+a.content[x].tel+'\r';};"
- StrJs = objson.Eval(StrJs)
- End With
- With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
- .SetText StrJs
- .PutInClipboard
- End With
- With ActiveSheet
- .Cells(Rows.Count, 1).End(xlUp).Offset(1).Select
- .Paste
- End With
- Next p
- End Sub
复制代码 |
|