{"id":15087,"date":"2019-03-20T18:56:02","date_gmt":"2019-03-20T18:56:02","guid":{"rendered":"http:\/\/learnexcelmacro.com\/wp\/?p=15087"},"modified":"2022-08-17T19:12:44","modified_gmt":"2022-08-17T19:12:44","slug":"distance-calculator-in-excel-vba-revised","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/","title":{"rendered":"Distance Calculator in Excel VBA [REVISED]"},"content":{"rendered":"

[et_pb_section fb_built=”1″ _builder_version=”4.17.6″ custom_padding=”0px|0px||0px|false|false” da_disable_devices=”off|off|off” global_colors_info=”{}” da_is_popup=”off” da_exit_intent=”off” da_has_close=”on” da_alt_close=”off” da_dark_close=”off” da_not_modal=”on” da_is_singular=”off” da_with_loader=”off” da_has_shadow=”on”][et_pb_row _builder_version=”4.16″ background_size=”initial” background_position=”top_left” background_repeat=”repeat” global_colors_info=”{}”][et_pb_column type=”4_4″ _builder_version=”4.16″ custom_padding=”|||” global_colors_info=”{}” custom_padding__hover=”|||”][et_pb_text _builder_version=”4.17.6″ background_size=”initial” background_position=”top_left” background_repeat=”repeat” global_colors_info=”{}”]<\/p>\n

Hi guys, on June 2016, google<\/a> made some changesaround pricing and authentication<\/a> etc. of its FREE APIs.Distance calculator API<\/a> was also affected by those changes. I had written an article long back about how to calculate distance and time taken <\/a> between two places in Excel VBA using google matrix api. In addition to this article, I also built a small Excel tool that calculates the distance and time taken between two places you type it in. It also has an option to choose your mode of transport. It looks something like the below:<\/p>\n

\"Distance

Distance Calculator<\/p><\/div><\/figure>\n

Ever since the changes have taken place, I am getting many questions from LEM readers that this tool does not work for them anymore.<\/p>\n

Therefore, I thought to write this article to explain to you more in detail.<\/p>\n

In the previous article, I have simply shared a simple VBA code to call Distance matrix API – where no authentication (API Key) was required…<\/em><\/strong><\/p>\n

After that change, the tool I had created and an article I had published was not working. Although I had replied via comments many times, I keep getting this question again and again. Therefore, I decided to write this article to answer all the questions at once.<\/p>\n

Now, In order to invoke Distance matrix API from Google, first, you need to get an API key using your google account. For that matter, in order to access any of its APIs, you need to get an API key to authenticate your API calls.<\/p>\n

How to get Google API Key<\/h2>\n

You can follow the simple steps given here in this article from google – https:\/\/developers.google.com\/maps\/documentation\/distance-matrix\/get-api-key<\/a>. Before, you try to call the API from Excel VBA, get this API key for yourself.<\/p>\n

As I mentioned previously, it is no longer for free (100%), you will have some limitations by using your FREE account. more details can be found here<\/a><\/p>\n

How to use the API key – Excel VBA<\/h2>\n

As you have learned in the previous article about how to create different parameters before your make an API call, that remains exactly the same except for the fact that now you need to append &key=YOUR_API_KEY<\/em><\/strong><\/p>\n

For example: <\/strong>Here is how a sample URL looks like using an API key<\/p>\n

https:\/\/maps.googleapis.com\/maps\/api\/distancematrix\/xml?origins=Amsterdam&destinations=Utrecht&mode=driving&key=YOUR_API_KEY<\/pre>\n

What is fixed in the Tool<\/h2>\n

There are Two things: <\/strong><\/p>\n

In the code, I have added an exception handling, so that you know what is wrong with the API call. It was my mistake that in my previous article, I did not use any exception handling, therefore it was not clear what exactly the problem is.<\/p>\n

Secondly, I have added a placeholder for your API key which you can store in the config sheet and the tool is ready for your own use.<\/p>\n

VBA to calculate the distance between two places<\/h2>\n

Here is the VBA code to call Google Distance Matrix API and get the distance and time taken :<\/p>\n

\nFunction getDistanceAndTimeBetweenTwoPlaces() As Variant\n' This function will return an array holding\n' distance in meters and duration in seconds\n    Dim googleAPIRequest As XMLHTTP60\n    Dim domDoc As DOMDocument60\n    Dim xmlNodesList As IXMLDOMNodeList\n    Dim status As String\n    Dim errorMessage As String\n    \n    Dim response(1) As Variant 'array to hold distance & duration\n    \n    On Error GoTo err\n'API URL is formed in excel sheet config using exccel formula\n    urlForDistance = Range(\"urlForDistance\").Value\n    \n    Set googleAPIRequest = New XMLHTTP60\n' invoke the API to get the Distance Matrxi in XML format\n    googleAPIRequest.Open \"GET\", urlForDistance, False\n    googleAPIRequest.Send\n    \n' Get the response XML\n    Set domDoc = New DOMDocument60\n    domDoc.LoadXML googleAPIRequest.ResponseText\n'using xPath first get the status of the API Call\n    status = domDoc.SelectSingleNode(\"\/\/status[1]\").nodeTypedValue\n    \n    errorMessage = domDoc.Text\n    If status = \"OK\" Then\n' Using xPath get the distance\n        Set xmlNodesList = domDoc.SelectNodes(\"\/\/distance[1]\/*\")\n        response(0) = xmlNodesList(0).Text\n        \n' Using xPath get the duration\n        Set xmlNodesList = domDoc.SelectNodes(\"\/\/duration[1]\/*\")\n        response(1) = xmlNodesList(0).Text\n        \n' Return response with distance and duration in array\n        getDistanceAndTimeBetweenTwoPlaces = response\n        \n' release memory\n        Set xmlNodesList = Nothing\n    Else\n        \n        MsgBox errorMessage\n        \n    End If\nerr:\n    Set domDoc = Nothing\n    Set googleAPIRequest = Nothing\nEnd Function\n<\/code><\/pre>\n

 <\/p>\n

[\/et_pb_text][et_pb_cta title=”Distance Calculator Tool” button_url=”\/excel\/wp-content\/downloads\/Google-Distance-Calculator.xlsm” button_text=”Download FREE Workbook” admin_label=”FreeDownload-Sidebar-part-2″ _builder_version=”4.17.6″ _module_preset=”a50a16dd-d05f-4ea2-acab-1468d2e4010e” link_option_url_new_window=”on” button_letter_spacing_hover=”1px” saved_tabs=”all” global_colors_info=”{}” button_one_text_size__hover_enabled=”off” button_two_text_size__hover_enabled=”off” button_one_text_color__hover_enabled=”off” button_two_text_color__hover_enabled=”off” button_one_border_width__hover_enabled=”off” button_two_border_width__hover_enabled=”off” button_one_border_color__hover_enabled=”off” button_two_border_color__hover_enabled=”off” button_one_border_radius__hover_enabled=”off” button_two_border_radius__hover_enabled=”off” button_one_letter_spacing__hover_enabled=”off” button_two_letter_spacing__hover_enabled=”off” button_one_bg_color__hover_enabled=”off” button_two_bg_color__hover_enabled=”off”]<\/p>\n

Note:<\/h3>\n

Before you run this excel sheet, you need to get your API key generated from your google account and put that key in the excel sheet at a specified place and then enjoy using it.<\/p>\n

[\/et_pb_cta][et_pb_blurb title=”Suggested articles” use_icon=”on” font_icon=”||fa||900″ admin_label=”Blurb” _builder_version=”4.17.6″ _module_preset=”0249c68e-4de8-4f44-84ff-a9b1850785b6″ global_colors_info=”{}”]<\/p>\n

    \n
  1. Calculate distance between two places in Excel [With Fun]<\/a><\/li>\n
  2. VBA to Add Static Google Map in Excel Sheet<\/a><\/li>\n
  3. How to assign a shortcut key to a procedure or subroutine<\/a><\/li>\n
  4. Assign a Shortcut Key using Excel VBA<\/a><\/li>\n<\/ol>\n

    [\/et_pb_blurb][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n<\/span>","protected":false},"excerpt":{"rendered":"

    Hi guys, on June 2016, google made some changesaround pricing and authentication etc. of its FREE APIs.Distance calculator API was also affected by those changes. I had written an article long back about how to calculate distance and time taken between two places in Excel VBA using google matrix api. In addition to this article, […]<\/p>\n","protected":false},"author":45,"featured_media":242869,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"\r\n

    Hi guys, on June 2016, google<\/a> made some changes around pricing and authentication etc. of <\/a>its FREE APIs. Distance calculator API<\/a> was also affected by those changes.<\/p>\r\n\r\n

    I had written an article long back about how to calculate distance and time taken between two places in Excel VBA using google matrix api<\/a>. In addition to this article, I had also built a small Excel tool which calculates distance and time taken between two places you type it in. It also has an option to choose your mode of transport. It looks something like below:<\/p>\r\n\r\n

    \"\"<\/figure>\r\n\r\n

    Ever since the changes taken place, I am getting many questions from LEM readers that this tool does not work for them anymore.<\/p>\r\n\r\n

    Therefore, I thought to write this article to explain you more in detail.<\/p>\r\n\r\n

    In the previous article, i have simply shared a simple VBA code to call Distance matrix API - where no authentication (API Key) was required...<\/em><\/strong><\/p>\r\n\r\n

    After that changes, the tool I had created and article which I had published were not working. Although, I had replied via comments many time, but I keep getting this question again and again. Therefore, I decided to write this article to answer all the questions at once.<\/p>\r\n\r\n

    Now, In order to invoke Distance matrix API from google, first you need to get an API key using your google account. For that matter, in order to access any of its API, you need to get an API key to authenticate your API calls.<\/p>\r\n\r\n

    How to get Google API Key<\/h2>\r\n\r\n

    You can follow the simple steps given here in this article from google - https:\/\/developers.google.com\/maps\/documentation\/distance-matrix\/get-api-key<\/a> . Before, you try to call the API from Excel VBA, get this API key for yourself.<\/p>\r\n\r\n

    As I mentioned previously, it is no longer for free (100%) , you will have some limitations by using your FREE account. more details can be found here<\/a><\/p>\r\n\r\n

    How to use the API key - Excel VBA<\/h2>\r\n\r\n

    As you have learnt in the previous article how to create different parameters before your make a API call, that remains exactly same except the fact that now you need to append &key=YOUR_API_KEY<\/em><\/strong><\/p>\r\n\r\n

    For example: <\/strong>Here is how a sample URL looks like using API key<\/p>\r\n\r\n

    https:\/\/maps.googleapis.com\/maps\/api\/distancematrix\/xml?origins=Amsterdam&destinations=Utrecht&mode=driving&key=YOUR_API_KEY<\/pre>\r\n\r\n

    What is fixed in the Tool<\/h2>\r\n\r\n

    There Two things: <\/strong><\/p>\r\n\r\n

    In the code, I have added an exception handling, so that you know what is wrong with the API call. It was my mistake that in my previous article, I did not use any exception handling, therefore it was not clear what exactly the problem is.<\/p>\r\n\r\n

    Secondly, I have added a placeholder for your API key which you can store it in the config sheet and tool is ready for your own use.<\/p>\r\n\r\n

    VBA to calculate distance between two places<\/h2>\r\n\r\n

    Here is the VBA code to call Google Distance Matrix API and get distance and time taken :<\/p>\r\n\r\n

    \r\nFunction getDistanceAndTimeBetweenTwoPlaces() As Variant\r\n' This function will return an array holding\r\n' distance in meters and duration in seconds\r\n    Dim googleAPIRequest As XMLHTTP60\r\n    Dim domDoc As DOMDocument60\r\n    Dim xmlNodesList As IXMLDOMNodeList\r\n    Dim status As String\r\n    Dim errorMessage As String\r\n    \r\n    Dim response(1) As Variant 'array to hold distance & duration\r\n    \r\n    On Error GoTo err\r\n'API URL is formed in excel sheet config using exccel formula\r\n    urlForDistance = Range(\"urlForDistance\").Value\r\n    \r\n    Set googleAPIRequest = New XMLHTTP60\r\n' invoke the API to get the Distance Matrxi in XML format\r\n    googleAPIRequest.Open \"GET\", urlForDistance, False\r\n    googleAPIRequest.Send\r\n    \r\n' Get the response XML\r\n    Set domDoc = New DOMDocument60\r\n    domDoc.LoadXML googleAPIRequest.ResponseText\r\n'using xPath first get the status of the API Call\r\n    status = domDoc.SelectSingleNode(\"\/\/status[1]\").nodeTypedValue\r\n    \r\n    errorMessage = domDoc.Text\r\n    If status = \"OK\" Then\r\n' Using xPath get the distance\r\n        Set xmlNodesList = domDoc.SelectNodes(\"\/\/distance[1]\/*\")\r\n        response(0) = xmlNodesList(0).Text\r\n        \r\n' Using xPath get the duration\r\n        Set xmlNodesList = domDoc.SelectNodes(\"\/\/duration[1]\/*\")\r\n        response(1) = xmlNodesList(0).Text\r\n        \r\n' Return response with distance and duration in array\r\n        getDistanceAndTimeBetweenTwoPlaces = response\r\n        \r\n' release memory\r\n        Set xmlNodesList = Nothing\r\n    Else\r\n        \r\n        MsgBox errorMessage\r\n        \r\n    End If\r\nerr:\r\n    Set domDoc = Nothing\r\n    Set googleAPIRequest = Nothing\r\nEnd Function\r\n<\/code><\/pre>\r\n\r\n

    Download the working Distance Calculator Tool<\/h2>\r\n\r\n
    \r\n

    Note:<\/h3>\r\n

    Before you run this excel sheet, you need to get your API key generated from your google account and put that key in the excel sheet at specified place and then enjoy using it.<\/p>\r\n<\/div>","_et_gb_content_width":"","footnotes":""},"categories":[1246,2077,1682],"tags":[],"class_list":["post-15087","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-macro","category-excel-tools","category-popular-articles"],"yoast_head":"\nDistance Calculator in Excel VBA [REVISED] - Let's excel in Excel<\/title>\n<meta name=\"description\" content=\"VBA to get distance calculated between two places. - Distance calculator in Excel using Google API. - Calculate time taken between two places in Excel VBA\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Distance Calculator in Excel VBA [REVISED]\" \/>\n<meta property=\"og:description\" content=\"VBA to get distance calculated between two places. - Distance calculator in Excel using Google API. - Calculate time taken between two places in Excel VBA\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/\" \/>\n<meta property=\"og:site_name\" content=\"Let's excel in Excel\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-20T18:56:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-17T19:12:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"920\" \/>\n\t<meta property=\"og:image:height\" content=\"466\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"author\" content=\"Vishwamitra Mishra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/learnexcelmacro\" \/>\n<meta name=\"twitter:site\" content=\"@learnexcelmacro\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vishwamitra Mishra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/\"},\"author\":{\"name\":\"Vishwamitra Mishra\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"headline\":\"Distance Calculator in Excel VBA [REVISED]\",\"datePublished\":\"2019-03-20T18:56:02+00:00\",\"dateModified\":\"2022-08-17T19:12:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/\"},\"wordCount\":888,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif\",\"articleSection\":[\"Excel Macro\",\"Excel Tools\",\"Popular Articles\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/\",\"name\":\"Distance Calculator in Excel VBA [REVISED] - Let's excel in Excel\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif\",\"datePublished\":\"2019-03-20T18:56:02+00:00\",\"dateModified\":\"2022-08-17T19:12:44+00:00\",\"description\":\"VBA to get distance calculated between two places. - Distance calculator in Excel using Google API. - Calculate time taken between two places in Excel VBA\",\"breadcrumb\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#primaryimage\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif\",\"width\":920,\"height\":466,\"caption\":\"Distance Calculator\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vmlogger.com\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel Macro\",\"item\":\"https:\/\/vmlogger.com\/excel\/macro\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Distance Calculator in Excel VBA [REVISED]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\",\"url\":\"https:\/\/vmlogger.com\/excel\/\",\"name\":\"Let's excel in Excel\",\"description\":\"Let's share knowledge\",\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vmlogger.com\/excel\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\",\"name\":\"Vishwamitra Mishra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"width\":528,\"height\":560,\"caption\":\"Vishwamitra Mishra\"},\"logo\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\"},\"description\":\"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.\",\"sameAs\":[\"http:\/\/www.learnexcelmacro.com\",\"http:\/\/www.facebook.com\/vmlogger\",\"https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro\",\"https:\/\/www.youtube.com\/c\/VMLogger\"],\"url\":\"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Distance Calculator in Excel VBA [REVISED] - Let's excel in Excel","description":"VBA to get distance calculated between two places. - Distance calculator in Excel using Google API. - Calculate time taken between two places in Excel VBA","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/","og_locale":"en_US","og_type":"article","og_title":"Distance Calculator in Excel VBA [REVISED]","og_description":"VBA to get distance calculated between two places. - Distance calculator in Excel using Google API. - Calculate time taken between two places in Excel VBA","og_url":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/","og_site_name":"Let's excel in Excel","article_publisher":"http:\/\/www.facebook.com\/vmlogger","article_author":"http:\/\/www.facebook.com\/vmlogger","article_published_time":"2019-03-20T18:56:02+00:00","article_modified_time":"2022-08-17T19:12:44+00:00","og_image":[{"width":920,"height":466,"url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif","type":"image\/gif"}],"author":"Vishwamitra Mishra","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/learnexcelmacro","twitter_site":"@learnexcelmacro","twitter_misc":{"Written by":"Vishwamitra Mishra","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#article","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/"},"author":{"name":"Vishwamitra Mishra","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"headline":"Distance Calculator in Excel VBA [REVISED]","datePublished":"2019-03-20T18:56:02+00:00","dateModified":"2022-08-17T19:12:44+00:00","mainEntityOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/"},"wordCount":888,"commentCount":2,"publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif","articleSection":["Excel Macro","Excel Tools","Popular Articles"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/","url":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/","name":"Distance Calculator in Excel VBA [REVISED] - Let's excel in Excel","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#primaryimage"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif","datePublished":"2019-03-20T18:56:02+00:00","dateModified":"2022-08-17T19:12:44+00:00","description":"VBA to get distance calculated between two places. - Distance calculator in Excel using Google API. - Calculate time taken between two places in Excel VBA","breadcrumb":{"@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#primaryimage","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2019\/03\/Distance.gif","width":920,"height":466,"caption":"Distance Calculator"},{"@type":"BreadcrumbList","@id":"https:\/\/vmlogger.com\/excel\/2019\/03\/distance-calculator-in-excel-vba-revised\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vmlogger.com\/excel\/"},{"@type":"ListItem","position":2,"name":"Excel Macro","item":"https:\/\/vmlogger.com\/excel\/macro\/"},{"@type":"ListItem","position":3,"name":"Distance Calculator in Excel VBA [REVISED]"}]},{"@type":"WebSite","@id":"https:\/\/vmlogger.com\/excel\/#website","url":"https:\/\/vmlogger.com\/excel\/","name":"Let's excel in Excel","description":"Let's share knowledge","publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vmlogger.com\/excel\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5","name":"Vishwamitra Mishra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","width":528,"height":560,"caption":"Vishwamitra Mishra"},"logo":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/"},"description":"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.","sameAs":["http:\/\/www.learnexcelmacro.com","http:\/\/www.facebook.com\/vmlogger","https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro","https:\/\/www.youtube.com\/c\/VMLogger"],"url":"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/"}]}},"_links":{"self":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/15087"}],"collection":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/comments?post=15087"}],"version-history":[{"count":0,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/15087\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media\/242869"}],"wp:attachment":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media?parent=15087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/categories?post=15087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/tags?post=15087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}