VBA Function for inserting hyperlink into an image

Derek Fingleson

New Member
Joined
Jan 22, 2020
Messages
16
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
PLEASE SEE THE BOTTOM OF THIS SUB..
I'm Trying to insert code that will place a hyperlink IN the image !
The Hyperlinks are all located in Col A
The pics are loaded in Col B

--------------------------------------------

Sub loadPicture()
Dim Pic_Location As String, picNumber As Integer
Dim cellLocation As Range
Dim Pic_Name As String, totalRows As Integer

'To check totalRows in column A
totalRows = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

For picNumber = 2 To totalRows
Set cellLocation = ActiveSheet.Range("B" & picNumber)
Pic_Location = ActiveSheet.Range("A" & picNumber)
Set Pic = cellLocation.Parent.Pictures.Insert(Pic_Location)

With Pic
'.ShapeRange.LockAspectRatio = msoFalse
.Top = Cells(picNumber, 2).Top
.Left = Cells(picNumber, 2).Left
.Height = 0.9 * 72
.Hyperlinks.Add , Address:=Pic_Location ( This Fuction is Wrong ? )


End With
Next
End Sub
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Watch MrExcel Video

Forum statistics

Threads
1,127,407
Messages
5,624,587
Members
416,036
Latest member
eloisa manzanarez

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
Top