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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,215,540
Messages
6,125,405
Members
449,223
Latest member
Narrian

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