+ Reply to Thread
Results 1 to 7 of 7

Solved, Get google maaps total distance without API

  1. #1
    Registered User
    Join Date
    06-30-2018
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    44

    Solved, Get google maaps total distance without API

    Hi

    I was wondering if it was possible to get the total distance between a route in Google maps without API and get it into excel with help of VBA?

    Best regards
    Martin
    Last edited by Vibov; 11-16-2020 at 05:11 AM. Reason: Solved

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,882

    Re: Get google maaps total distance without API

    There is. You just need to pilot IE11 and read data off of that.

    I did something similar years back, not for distance, but for geo-coordinate.

    Base code sample:
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    06-30-2018
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    44

    Re: Get google maaps total distance without API

    Thanks CK76, but I believe this only are possible because the data are avaliable in the line for the webaddress and distance and time don´t seams to appear here but only at the webpage for google maps.

    If you look at this string with multiple stops, then distance and time are not showed:
    https://www.google.dk/maps/dir/Greve...41!2d55.580912


    I´m beginning to thing google´s API now are the only solutions, unfortunal but thank you very much for your input :-)

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,882

    Re: Get google maaps total distance without API

    It's still possible. You just have to construct URL request and scrape data off of HTML document.

    Ex: Add reference to MS HTML object and MS Internet Controls in your project.

    Please Login or Register  to view this content.
    EDIT: Increase wait time as needed.

    Commented out section is to export HTMLDocument.Body.innerHTML out to text file to inspect and identify element that hold the info desired.

    See attached.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-30-2018
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    44

    Re: Get google maaps total distance without API

    Thanks CK76 - But instead of Debug.print how do I get the information into a variable or in a specific cell of the workbook?

  6. #6
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,147

    Re: Get google maaps total distance without API

    As an alternative, you can use Google Sheets to calculate the distance and duration between start and destination points.

    https://docs.google.com/spreadsheets...it?usp=sharing

  7. #7
    Registered User
    Join Date
    06-30-2018
    Location
    Denmark
    MS-Off Ver
    2013
    Posts
    44

    Re: Get google maaps total distance without API

    Thank you all. Solved

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calculating total road distance and duration with google distance matrixes api
    By musta in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2019, 07:21 AM
  2. Distance matrix with google API
    By Kdeepesh in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-07-2019, 05:50 AM
  3. Driving distance using google API
    By AV114 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2018, 07:51 AM
  4. Google API/distance calculator
    By Juicemand in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-07-2017, 08:27 AM
  5. [SOLVED] Google Distance Matrix API - Distance and Time
    By rtcwlomax in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2014, 08:42 PM
  6. Google distance and time
    By A[L]C in forum Excel General
    Replies: 5
    Last Post: 12-21-2011, 08:39 AM
  7. Use google maps to get distance
    By rdr910 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-13-2010, 09:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1