Inserting an image from google maps based on a URL in a cell

Owain_b

New Member
Joined
May 1, 2018
Messages
8
Hi,

I have data from a data base that I export into excel and paste into an excel spreadsheet which formats the data to look presentable.

The data has a google maps location URL column and I would like to write some VBA based on the cells with the URL to insert a satellite image of this location into a shape on the formatted tap of the spreadsheet.

Is this possible? I have tried several things and no joy. I have even setup a Static maps API key to add to the URL but it just doesnt work. The most promising thing I have tried is:

HTML:
Option Explicit
Sub insertMap()
Dim APIKey As String
Dim gAPIMapUrl As String

APIKey = "my key goes here"

        gAPIMapUrl = Sheets(Sheet1).Cells("Y2").Value & "&key=" & APIKey    

        Shapes("Rectangle 1").Fill.UserPicture gAPIMapUrl    

End Sub

With this I get the 'Run-time error '-2146697208 (800c0008)': Automation error The download of the specified resource has failed.

Example of a google maps URL in a cell:
https://www.google.co.uk/maps/@52.238951,-0.9039376,682m/data=!3m1!1e3?hl=en

Any help will be very much appreciated.

Thanks, Owain
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,223,889
Messages
6,175,226
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top