Hi,
I was originally using some VBA code and Google's API system to calculate distance between Post Codes, it looked like this:
Since using this function, Google have changed their system so that it requires a developer API key. Can anyone help me adjust this VBA code to work with my developer key?
Thanks,
Aaron
I was originally using some VBA code and Google's API system to calculate distance between Post Codes, it looked like this:
Code:
Function G_DISTANCE(Origin As String, Destination As String) As DoubleDim myRequest As XMLHTTP60
Dim myDomDoc As DOMDocument60
Dim distanceNode As IXMLDOMNode
G_DISTANCE = 0
On Error GoTo exitRoute
Origin = Replace(Origin, " ", "%20")
Destination = Replace(Destination, " ", "%20")
Set myRequest = New XMLHTTP60
myRequest.Open "GET", "http://maps.googleapis.com/maps/api/directions/xml?origin=" _
& Origin & "&destination=" & Destination & "&sensor=false", False
myRequest.send
Set myDomDoc = New DOMDocument60
myDomDoc.LoadXML myRequest.responseText
Set distanceNode = myDomDoc.SelectSingleNode("//leg/distance/value")
If Not distanceNode Is Nothing Then G_DISTANCE = distanceNode.Text / 1000
exitRoute:
Set distanceNode = Nothing
Set myDomDoc = Nothing
Set myRequest = Nothing
End Function
Since using this function, Google have changed their system so that it requires a developer API key. Can anyone help me adjust this VBA code to work with my developer key?
Thanks,
Aaron