如何让此代码与 Safari 或 Firefox 一起使用?
Public Function getGoogDistanceTime(startAddr As String, startCity As String, _
startState As String, startZip As String, endAddr As String, _
endCity As String, endState As String, endZip As String) As String
Dim sURL As String
Dim BodyTxt As String
Dim apan As String
Dim oXH As Object
sURL = "http://maps.google.com/maps?f=d&source=s_d&saddr="
sURL = sURL & Replace(startAddr, " ", "+") & ",+" & Replace(startCity, " ", "+") & ",+" & startState
sURL = sURL & "&daddr=" & Replace(endAddr, " ", "+") & ",+" & Replace(endCity, " ", "+") & ",+" & endState
sURL = sURL & "&hl=en"
Set oXH = CreateObject("msxml2.xmlhttp")
With oXH
.Open "get", sURL, False
.Send
BodyTxt = .RESPONSETEXT
End With
apan = Application.WorksheetFunction.Trim(apan)
apan = Mid(BodyTxt, InStr(1, BodyTxt, "<div class=""altroute-rcol altroute-info"">") + 49, 200)
apan = Left(apan, InStr(1, apan, "</span> </div>") - 1)
apan = Replace(apan, "</span>", "")
apan = Replace(apan, "<span>", "")
getGoogDistanceTime = apan
Set oXH = Nothing
End Function