If you want to find out the GPS coordinates of a certain location it's zip code combined with the country's name will suffice.
Activate a reference to the library Microsoft XML v3.0 before running the code.
Sub gps_test() MsgBox gps("7631CP", "nederland"), , "GPS coördinates of ZIPcode 7631CP in The Netherlands" End SubFunction gps(ZIP, country) With New MSXML.XMLHTTPRequest .Open "Get", "http://maps.google.nl/maps?saddr=" & ZIP & "+" & country .send Do DoEvents Loop Until .ReadyState = 4 gps = Replace(Mid(.responseText, InStr(.responseText, "offsetHeight}") + 14, 19) & "#", ",#", "") .abort End With End Function
If you put this function into a macromodule, you can also use it in a worksheet. E.g.
In A1: 7631CP
In B1: nederland
In C1: dependent of the International SettingsPHP Code:=gps(A1;B1)
or
=gps(A1,B1)
Last edited by snb; 01-06-2011 at 05:40 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks