Opening websites programmatically at their certain addresses is quite a straightforward thing regardless of the programming language. Previously I dealt with launching Google Maps from the Excel document with the Google Chrome browser. Now I would like to explain to you briefly the option, which allows you to open the Street View image anywhere you want. The basis remains the same. You have to define the coordinates earlier – from the position of your spreadsheet. For clarity, this is one of at least two other ways to link Google Street View with your Excel worksheet. In other cases, you can (or at least you could before 2018) open the Street View by hyperlink or even embed the Street View frame into your worksheet, which appears to be much more snazzy.
I won’t deal with them now, but you can visit the links attached below. My article will be somewhat of a supplement to the previous one discussed earlier.
The key link here looks like this:
To get your coordinates you can use the geocoding tools for Excel discussed in a few articles previously. You can do it for free by using Bing or Nominatim if they are not provided directly.
An example cell with the coordinates prepared for the Google Street View permalink format should look like this:
which is roughly the result of the Nominatim geocoding function.
Finally, the full VBA code will be in the following form:
Sub GoogleStreetView() Dim Coordinates As String Dim url As String Coordinates = Sheets("Frontsheet").Range("AE2").Value ' The cell with coordinates url = "https://www.google.com/maps?q=&layer=c&cbll=" & Coordinates OpenChrome url End Sub Sub OpenChrome(URL As String) Dim Chrome As String Chrome = "C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe -url" Shell (Chrome & " " & URL) End Sub
which next triggers the Google Street View to open in the Chrome browser exactly at the pace of the coordinates defined (Pic. 1).