![google maps api vba google maps api vba](https://i.ytimg.com/vi/x17awnnZUUM/maxresdefault.jpg)
The response of the web request is then parsed by VBA-JSON and the relevant variable returned. It is simply takes the three parameters and formats them into a web request. With the references configured, we can now write the code for the function. Please make sure the pictured references are selected. More details can be found at the bottom of the project homepage.
Google maps api vba install#
If you require support for Excel for Mac, you will need to install VBA-Dictionary from the author of VBA-JSON. Go to Tools > References… In addition to the references already selected, check off “Microsoft Scripting Runtime” (for Dictionary support needed by VBA-JSON) and “Microsoft WinHTTP Services, version 5.1” (to make the HTTP request to the API).
![google maps api vba google maps api vba](https://ramblings.mcpher.com/wp-content/uploads/2019/12/Capture.png)
![google maps api vba google maps api vba](https://4.bp.blogspot.com/-H5vtnZv5VDU/WMfZNfQVnaI/AAAAAAAALYo/QUlwx0n26CYB-SJInXKNrSn-fKrC_603QCLcB/s1600/VBA-Specialist-vba-excel-usando-api-do-google-maps.jpg)
Next, make sure the appropriate references are enabled. Import JsonConverter.bas using the Import File... function. A JsonConverter module will appear in the sidebar. In order to import the VBA-JSON file, go to File > Import File… (Ctrl + M). Right click the ribbon, go to “Customize the Ribbon…”, and check Developer under Main tabs. If you do not have this button, ensure the “Developer” tab is enabled. Open the Visual Basic Editor (Alt + F11). You can download the latest version from here. Step 1: Create a new macro file and add VBA-JSONīecause the Google Maps Directions API is a JSON API, we will use VBA-JSON to make it easy to use the results from the web request. Create a new project and make sure the Directions API is added. The “Getting Started” page can help you with this. In order to use the function, an API key is required. The origin and destination will be strings, and can be either an exact address or the name of a place. The format of the function will be as follows: =TRAVELTIME(origin, destination, api_key), =TRAVELDISTANCE(origin, destination, apikey). This will allow you to get the travel time between the two locations. In this article, we will create an Excel function to calculate the distance between two addresses using the Google Maps directions API.