Sub GoogleMaps()
Dim myRequest As XMLHTTP60
Dim myDomDoc As DOMDocument60
Dim journey As IXMLDOMNode
I've got this code to pull a distance between addresses from google maps. How can I modify it to run in a loop starting in row 2 and stop when it sees no more address's. The origin address is in column D, the destination is in column E, and the mileage is in column F.
Set myRequest = New XMLHTTP60
myRequest.Open "Get", " _
& Range("d13").Value & "&destination=" & Range("E13").Value & "&sensor=false", False
myRequest.send
Set myDomDoc = New DOMDocument60
myDomDoc.LoadXML myRequest.responseText
Set journey = myDomDoc.SelectSingleNode("//leg/distance/value")
Range("F13").Value = Round(journey.Text / 1000 / 1.609344, 0)
exitRoute:
Set journey = Nothing
Set myDomDoc = Nothing
Set myRequest = Nothing
End Sub
Dim myRequest As XMLHTTP60
Dim myDomDoc As DOMDocument60
Dim journey As IXMLDOMNode
I've got this code to pull a distance between addresses from google maps. How can I modify it to run in a loop starting in row 2 and stop when it sees no more address's. The origin address is in column D, the destination is in column E, and the mileage is in column F.
Set myRequest = New XMLHTTP60
myRequest.Open "Get", " _
& Range("d13").Value & "&destination=" & Range("E13").Value & "&sensor=false", False
myRequest.send
Set myDomDoc = New DOMDocument60
myDomDoc.LoadXML myRequest.responseText
Set journey = myDomDoc.SelectSingleNode("//leg/distance/value")
Range("F13").Value = Round(journey.Text / 1000 / 1.609344, 0)
exitRoute:
Set journey = Nothing
Set myDomDoc = Nothing
Set myRequest = Nothing
End Sub