|
- Sub Main() '主體代碼
- Dim strText As String
- Dim objJSON As Object
- URL = "http://map.baidu.com/?"
- URL = URL & "&qt=nav"
- URL = URL & "&da_src=pcmappg.searchBox.button"
- URL = URL & "&c=1"
- URL = URL & "&sn=" & Escape("2$$$成都市$0$$")
- URL = URL & "&en=" & Escape("2$$$杭州市$0$$")
- With CreateObject("MSXML2.XMLHTTP")
- .Open "GET", URL & "&t=" & Rnd(), False
- .send
- strText = .responseText
- CopyToClipbox strText
- End With
-
- With CreateObject("msscriptcontrol.scriptcontrol")
- .Language = "JavaScript"
- .AddCode "var mydata=" & strText
- Set objJSON = .CodeObject
- End With
- Set temp_call = CallByName(objJSON.mydata, "content", VbGet)
- Debug.Print temp_call.dis
- temp_time = CallByName(temp_call, "time", VbGet)
- Debug.Print temp_time
- Debug.Print temp_time / 3600
- End Sub
- Public Function Escape(ByVal strText As String) As String '如果值中?有非英文和?字,?需??成%形式
- Set JS = CreateObject("msscriptcontrol.scriptcontrol")
- JS.Language = "JavaScript"
- Escape = JS.Eval("encodeURI('" & Replace(strText, "'", "\'") & "');")
- End Function
复制代码 我只真入這些,可以嗎? 但找出來的時間次次不同的,不明白
|
|