|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
这个问题还是有点难度的- Sub cc()
- Cells.ClearContents
- ReDim arr(1 To 1000, 1 To 3)
- Set Js = CreateObject("msscriptcontrol.scriptcontrol")
- Js.Language = "JavaScript"
- tt = Js.Eval("(new Date).getTime();")
- With CreateObject("MSXML2.XMLHTTP")
- For p = 0 To 4
- .Open "get", "http://map.baidu.com/?newmap=1&reqflag=pcmap&biz=1&from=webmap&qt=s&from=webmap&c=191&pl_data_type=life&pl_sub_type=KTV&pl_price_section=0%2C%2B&pl_sort_type=data_type&pl_sort_rule=0&pl_discount2_section=0%2C%2B&pl_groupon_section=0%2C%2B&pl_cater_book_pc_section=0%2C%2B&pl_ticket_book_flag_section=0%2C%2B&pl_movie_book_section=0%2C%2B&pl_business_type=life&pl_business_id=&pl_activity_gwj_section=0%2C%2B&wd=ktv&pn=" & p & "&db=0&wd2=&sug=0&da_src=pcmappg.poi.page&on_gel=1&src=7&gr=3&b=(12948998.92,4744884.22;13034054.92,4792692.22)&l=12&addr=0&nn=" & p * 10 & "&tn=B_NORMAL_MAP&ie=utf-8&t=" & tt, False
- .send
- Js.addcode "function decode(str){return unescape(str.replace(/\u/g,'%u'));}"
- s = Js.Eval("decode('" & .responsetext & "')")
- t = Filter(Split(s, "[],"), "poi_address")
- For i = 0 To UBound(t)
- Js.addcode "a={" & Split(t(i), ",""point""")(0) & "}"
- k = k + 1
- arr(k, 1) = Js.Eval("a.name")
- arr(k, 2) = Js.Eval("a.phone")
- arr(k, 3) = Js.Eval("a.poi_address")
- Next
- Next
- End With
- [a1:c1] = Array("名称", "电话", "地址")
- [a2].Resize(UBound(arr), 3) = arr
- End Sub
复制代码 |
|