Inserting a URL into a shape using VBA

jsharp

New Member
Joined
Dec 12, 2022
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
I have a macro I am using to create sheets based off of a template. I'm wondering how to use that macro to also insert a static map url into a shape based off of what sheet was created. This is the code for the create sheets

Sub CreateSheets()
Dim LR As Long, i As Long
Application.ScreenUpdating = False
With Sheets("Stop Data")
LR = .Range("B" & Rows.Count).End(xlUp).Row
For i = 2 To LR
Sheets("Template").Copy Before:=Sheets("Template")
ActiveSheet.Name = .Range("B" & i).Value
Next i
End With
Application.ScreenUpdating = True
End Sub

I found out how to load the image into the shape with this.

Sub MapInsert()
With ActiveSheet.Shapes("Map").Fill
.Visible = msoTrue
.UserPicture "https://maps.googleapis.com/maps/ap...7&zoom=17&size=775x775&maptype=satellite&key="
.TextureTile = msoFalse
End With

The sheet that is created is named what is in Column B and everything from the template is carried over.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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