Inserting an Hyperlink on an installed picture

mtheriault2000

Well-known Member
Joined
Oct 23, 2008
Messages
826
Hello again

I got code that is installing a picture over a range on my sheet.

Now, I would like to add an hyperlink to the picture so if I click on it, I will be opening my Snap Picture application

Problem is every time I create or install a new picture, the name of it change so I can't install an hyperlink over a picture that I don't know the name...

Hope I'm clear

Martin
Code:
Sub test2()


Dim MyDocument As Variant
Dim MyShape As Variant
Dim SelectImage As String
Dim TopLeft_ As Range
Dim TopRight_ As Range
Dim DownLeft_ As Range
Dim DownRight_ As Range


SelectImage = "File://G:\SnapVault\20140119_03_33_09.jpg"
Set MyDocument = Worksheets("OrderInfo")


Set TopLeft_ = MyDocument.Range("TopLeft")
Set TopRight_ = MyDocument.Range("TopRight")
Set DownLeft_ = MyDocument.Range("DownLeft")
Set DownRight_ = MyDocument.Range("DownRight")
'MyDocument.Pictures.Insert (SelectImage)


MyDocument.Select


  With ActiveSheet.Pictures.Insert(SelectImage)
'        .Top = Range("B4").Top
'        .Left = Range("B4").Left
'        .Height = Range("B10").Top - Range("B4").Top
'        .Width = Range("H4").Left - Range("B4").Left
            .Left = TopLeft_.Left
            .Top = TopRight_.Top
            .Height = TopLeft_.Top - DownLeft_.Top
            .Width = DownRight_.Left - DownLeft_.Left
        End With
        
 ' MyDocument.SelectImage.Hyperlinks.Add Anchor:=SelectImage
End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
OK, now I did succeed to name the install picture ("Image_1"). Eache time a picture is inserted in my sheet, name("Picture_1") will be attributed to it.


So now the problem remaining is: How to add an Hyperlinks to a picture ("Picture_1")

Martin :)
 
Upvote 0
Where is the error: Inserting an Hyperlink on an installed picture

I'M one step further now,

Code:
Sub test2()


Dim MyDocument As Variant
Dim MyShape As Variant
Dim SelectImage As String
Dim TopLeft_ As Range
Dim TopRight_ As Range
Dim DownLeft_ As Range
Dim DownRight_ As Range
Dim Pic As Picture




SelectImage = "File://G:\SnapVault\20140119_03_33_09.jpg"
Set MyDocument = Worksheets("OrderInfo")


Set TopLeft_ = MyDocument.Range("TopLeft")
Set TopRight_ = MyDocument.Range("TopRight")
Set DownLeft_ = MyDocument.Range("DownLeft")
Set DownRight_ = MyDocument.Range("DownRight")


Set Pic = MyDocument.Pictures.Insert(SelectImage)
Pic.Select




'MyDocument.Select


  With Selection
'        .Top = Range("B4").Top
'        .Left = Range("B4").Left
'        .Height = Range("B10").Top - Range("B4").Top
'        .Width = Range("H4").Left - Range("B4").Left
            .Left = TopLeft_.Left
            .Top = TopRight_.Top
            .Height = DownLeft_.Top - TopLeft_.Top
            .Width = TopRight_.Left - TopLeft_.Left
            Selection.Name = "Image_1"
        End With
        
        ActiveSheet.Hyperlinks.Add _
        Anchor:=MyDocument.Pic, Address:=SelectImage
      
End Sub
[CODE]

The error is with these lines.  Error 438,  Property not managed by this object
    ActiveSheet.Hyperlinks.Add _
    Anchor:=MyDocument.Pic, Address:=SelectImage

[/CODE]
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

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