+ Reply to Thread
Results 1 to 1 of 1

Thread: GPS coordinates based on ZIP code & country

  1. #1
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    GPS coordinates based on ZIP code & country

    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 Sub
    Function 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 Settings
    PHP Code: 
    =gps(A1;B1)
     
    or        

    =
    gps(A1,B1
    Last edited by snb; 01-06-2011 at 05:40 PM.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0