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
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I'm actually looking for an answer similar to this, have you had any luck finding your answer?

I have a macro for the accounting portion of my workbook that copies a hidden image (makes if visible), renames it (based on a cell reference), pastes it in a specific location (next to a given invoice #). And from there it's supposed to have the hyperlink changed to point towards the a newly created sheet (also based on a cell reference).

I can get everything else to work except the hyperlink (to the hidden sheet, which means Ctrl+K won't even work). So maybe if you had some luck with yours, you could share...
 
Upvote 0
Is this any help:
 
Upvote 0
Is this any help:
I've pretty much read through everything on this forum (and others), including that particular thread and it didn't help much. The question seems to be asked a lot, and no one says it's not possible, but never a definitive answer as to how.

The main issue I have appears to be that my sheets are all hidden. Otherwise I could simply use the HYPERLINK() formula. But that won't go to hidden sheets. The only way to jump to a hidden sheet is the (Ctrl+K) method or .visible = True.

I ran into a similar issue on another section of the workbook but was able to find a work around with the addition of an "update" macro on a specific sheet that basically recoded everything on the new sheet. But here, I absolutely have to have the hyperlink work with a variable SubAddress.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,851
Members
449,051
Latest member
excelquestion515

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