excel vba - Google Maps Directions Only -


i working on project want display google map in webbrowser object in on excel sheet. have accomplished using url....

http://maps.google.com/?saddr=29.9390146,-90.0696139&daddr=29.962506,-90.1930133&f=d&output=embed

i display driving directions same link (or different one).

i cannot find info on how google maps return directions via url.

ahia, larryr

you want check out googlemaps api:

static map api

directions api

these api provides xml response can parse them results displayed. made 1 find time , distance can use example: 1 of earlier attempts no xml used give idea how work responses google.

public function gmap(origin_address string, destination_address string, optional mode integer = 1, optional datatype integer = 1)  dim surl string dim oxh object dim bodytxt string dim time_e string dim distanc_e string dim strmode string  if mode = 1     strmode = "walking" elseif mode = 2     strmode = "driving" elseif mode = 3     strmode = "bicycling" else     gmap = "invalid mode"     exit function end if  surl = "http://maps.googleapis.com/maps/api/distancematrix/xml?origins=;" & _ replace(origin_address, " ", "+") & "&destinations=" & replace(destination_address, " ", "+") & _ "&mode=" & strmode & "&sensor=false&units=metric"  set oxh = createobject("msxml2.xmlhttp")  oxh     .open "get", surl, false     .send     bodytxt = .responsetext end  bodytxt = right(bodytxt, len(bodytxt) - instr(1, bodytxt, "<text>") - 5) tim_e = left(bodytxt, instr(1, bodytxt, "</text>") - 1) bodytxt = right(bodytxt, len(bodytxt) - instr(1, bodytxt, "<text>") - 5) distanc_e = left(bodytxt, instr(1, bodytxt, "</text>") - 1)  if datatype = 1     gmap = cdbl(replace(tim_e, "mins", "")) elseif datatype = 2     gmap = cdbl(replace(distanc_e, "km", "")) else     gmap = "invalid data" end if  set oxh = nothing end function 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -