|
有多个选择的放到e2单元格。- Sub 按钮1_Click()
- Dim url, js, lastRow
- lastRow = Range("b1048576").End(xlUp).Row
- For i = 2 To lastRow
- url = "http://map.baidu.com/?newmap=1&reqflag=pcmap&biz=1&from=webmap&sy=0&"
- url = url & "qt=nav&da_src=pcmappg.searchBox.button&c=289&sn=2$$$"
- url = url & Cells(i, 2) '这里是开始地址
- url = url & "$0$$&en=2$$$"
- url = url & Cells(i, 3) '这里是结束地址
- url = url & "$0$$&sc=289&ec=289&rn=5&time_index=-1&day=-1&extinfo=63&tn=B_NORMAL_MAP"
- url = url & "&nn=0&ie=utf-8&l=18&&t=1406857726467"
- Set js = CreateObject("scriptcontrol")
- js.Language = "jscript"
- With CreateObject("msxml2.xmlhttp")
- .Open "get", url, False
- .send
- tt = .responsetext
- js.eval ("qd=" & tt)
- Cells(i, 4) = js.eval("qd.content.dis") / 1000 & "公里"
- If js.eval("qd.content.dis") = 0 Then
- Cells(i, 5).ClearContents
- t = js.eval("qd.content[0].length")
- For j = 0 To t - 1
- Cells(i, 5) = Cells(i, 5) & js.eval("qd.content[0][" & j & "].name")
- Next
- End If
- End With
- Next
- End Sub
复制代码 |
|