• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Code executes well with breakpoint or Msgbox. but when i just run it does not give results

Sreedharun.g

New Member
I even tried appication.wait and does not seem to be working. Also i put API key in there. I did not put the actual key.

>>> use code - tags <<<
Code:
Option Explicit

Function GetCoordinates(Address As String) As String

    Dim ApiKey          As String
    Dim Request         As New XMLHTTP30
    Dim XMLL            As MSXML2.DOMDocument30
    Dim Results         As MSXML2.DOMDocument30
    Dim LatitudeNode    As IXMLDOMNode
    Dim LongitudeNode   As IXMLDOMNode
    Dim StatusNode      As String
    Dim X               As Date
    Dim Y               As Date
   
    Set Results = New MSXML2.DOMDocument
  
    Request.Open "GET", "http://open.mapquestapi.com/geocoding/v1/address?key=APIKey" _
    & "&location=" & Application.EncodeURL(Address) & "&outFormat=XML"
   
    Request.send
       
    Results.LoadXML (Request.responseText)
      
    Set LatitudeNode = Results.SelectSingleNode("//results/result/locations/location/displayLatLng/latLng/lat")
    Set LongitudeNode = Results.SelectSingleNode("//results/result/locations/location/displayLatLng/latLng/lng")
    GetCoordinates = LatitudeNode.Text & ", " & LongitudeNode.Text

End Function
 
Last edited by a moderator:
Top