I constantly use the website below to track air miles round trip. Recently, the website stopped working in IE, so my code did as well. Since I use this on a work computer, I cannot download many of the other solutions that I have found in my searches and I cannot use another website without going through a lengthy process to get the site approved. Is there a way to perform the same task here in Chrome without any other downloads?
Dim ele As Object Dim IE As New InternetExplorer IE.Visible = True IE.navigate "http://www.distancefromto.net" Do DoEvents Loop Until IE.readyState = READYSTATE_COMPLETE 'step 1 With IE .document.getElementsByName("distance")(0).Value = Range("B2").Value .document.getElementsByName("distance")(1).Value = Range("B3").Value & Range("E3").Value .document.getElementById("hae").Click Do DoEvents Loop Until IE.readyState = READYSTATE_COMPLETE Application.Wait (Now + TimeValue("0:00:02")) Dim a As String a = Trim(.document.getElementById("totaldistancemiles").Value) Dim aa As Variant aa = Split(a, " ") Range("C2").Value = aa(0) 'step 2 .document.getElementsByName("distance")(0).Value = Range("B4").Value & Range("E4").Value .document.getElementById("hae").Click Do DoEvents Loop Until IE.readyState = READYSTATE_COMPLETE Application.Wait (Now + TimeValue("0:00:02")) Dim b As String b = Trim(.document.getElementById("totaldistancemiles").Value) Dim bb As Variant bb = Split(b, " ") Range("C3").Value = bb(0) 'step 3 .document.getElementsByName("distance")(1).Value = Range("B2").Value .document.getElementById("hae").Click Do DoEvents Loop Until IE.readyState = READYSTATE_COMPLETE Application.Wait (Now + TimeValue("0:00:02")) Dim c As String c = Trim(.document.getElementById("totaldistancemiles").Value) Dim cc As Variant cc = Split(c, " ") Range("C4").Value = cc(0) End With IE.Quit
Any help, even a definitive “no, it’s not possible” would be greatly appriciated
To use Chrome – no. You would need to download selenium basic or use a different programming language e.g python.
You could switch to using a different site (appreciate there may some minor differences on your prior figures due to the website though technically the distances shouldn’t have changed that much!). I note you say that this would be problematic. At the risk of sounding stalkerish, you have used freemaptools before so that might be an acceptable choice?
If you find a site offering an API service you might be able to ditch all the above and issue an XMLHTTP request. I couldn’t see your site offering an API service otherwise that would have been the obvious next choice.
@RahulChalwa mentions “[the site OP is using is itself using a wrapper around google maps API: https://maps.googleapis.com/maps/api/js/GeocodeService.Search. User can register for API and do a POST request]”; so that might be the way forward. Main documentation here.
E.g. API site: Personal and small scale use API – wheretocredit.com
Current set-up debug:
Ascertain the reason for IE no longer working in your current set-up would also be advisable, perhaps by contacting the site developers and raising your issue.
Perform the calculation (as the site does) using the Vincenty’s formula or, as other sites do, using Haversine formula:
Vicenty’s (including sample code):
Vicenty’s code from Contextures. I have attributed but if this should not be included here I will remove.