bringing Google Maps data into Excel in iOS

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

We can use your code to ask Google Maps for distance and duration data into an Excel spreadsheet on a Windows machine – thanks. BUT the same xls won’t work on a Mac. Do you have a fix?

Here’s the offending line:
Set objHTTP = CreateObject(“MSXML2.ServerXMLHTTP”)

Here’s the code we were using in Excel for Windows:
Public Function GetDistance(start As String, dest As String)
Dim firstVal As String, secondVal As String, lastVal As String
firstVal = “”
secondVal = “&destinations=”
lastVal = “&mode=car&language=pl&sensor=false”
Set objHTTP = CreateObject(“MSXML2.ServerXMLHTTP”)
URL = firstVal & Replace(start, ” “, “+”) & secondVal & Replace(dest, ” “, “+”) & lastVal
objHTTP.Open “GET”, URL, False
objHTTP.setRequestHeader “User-Agent”, “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)”
objHTTP.send (“”)
If InStr(objHTTP.responseText, “””distance”” : {“) = 0 Then GoTo ErrorHandl

thanks, cheers, Bruce



not so easy Bruce. Unfortunately, I don’t use Mac and can’t help you there. VBA in Mac is generally no a good idea due to the limitations. If this is a one-off exercise I would recommend using Windows to download the data from Google and then do the data crunching on the Mac.

commented on answer

Simply the best place to learn Excel VBA