I am trying to use the above EncodeURL function in the code below and get
Compile error:
Sub or Function not defined.
Highlighting the Encodeurl function
Can somebody advise what i am doing wrong please
Compile error:
Sub or Function not defined.
Highlighting the Encodeurl function
Code:
Sub GetLatLong(strPostcode, strLatitude, strLongitude, strCountry)
Dim strGoogleApiKey
Dim strGooglePostcodeUrl
Dim objHTTP
Dim strHttpResponse
Dim objXML
strGoogleApiKey = "AIzaSyAC9AXAQkOAljbc0jPs8AqyM8uiNqHzASk" 'get your own key from Google and put it in here
strGooglePostcodeUrl = "http://maps.google.co.uk/maps/geo?output=csv&key=" & strGoogleApiKey & "&q=" & Encodeurl(strPostcode)
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHTTP.Open "GET", strGooglePostcodeUrl, False
objHTTP.send
strHttpResponse = objHTTP.responseText
arrHttpResponse = Split(strHttpResponse, ",")
'make sure the lookup hasn't returned an error 200 means success
'200 G_GEO_SUCCESS No errors occurred; the address was successfully parsed and its geocode was returned.
'500 G_GEO_SERVER_ERROR A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is unknown.
'601 G_GEO_MISSING_QUERY An empty address was specified in the HTTP q parameter.
'602 G_GEO_UNKNOWN_ADDRESS No corresponding geographic location could be found for the specified address, possibly because the address is relatively new, or because it may be incorrect.
'603 G_GEO_UNAVAILABLE_ADDRESS The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.
'610 G_GEO_BAD_KEY The given key is either invalid or does not match the domain for which it was given.
'620 G_GEO_TOO_MANY_QUERIES The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time. If you're sending multiple requests in parallel or in a tight loop, use a timer or pause in your code to make sure you don't send the requests too quickly.
If arrHttpResponse(0) = 200 Then
strLatitude = arrHttpResponse(2)
strLongitude = arrHttpResponse(3)
strCountry = "GB"
Else
strLatitude = vbNullString
strLongitude = vbNullString
strCountry = vbNullString
End If
End Sub
Can somebody advise what i am doing wrong please