Hyperlink invisible Excel VBA

Hello my friends,
I would like to make internet link text invisible in Excel cell in VBA programming.
In this same cell I display an icon.
By clicking on the icon I would have liked to be directed to the web page.
If Eugene passes by here, I can’t find an example in his work.
I have found that but I can not adapt the code in Xojo :

With Worksheets(1) 
 .Hyperlinks.Add Anchor:=.Shapes(1), _ 
 Address:="https://example.microsoft.com", _ 
 ScreenTip:="Microsoft Web Site", _ 
 TextToDisplay:="Microsoft" 
End With

Hello Benoit,

Here is the code to add a hyperlink to a picture. I will update the Excel book with various examples so that the rest of the community will also have access to these solutions.

Here is the code:

Sub Pressed() Handles Pressed
  Var excel As New ExcelApplication
  excel.workbooks.add
  excel.visible = True
 
  //Choose the cell to place the shape (B2)
  excel.ActiveSheet.cells(2, 2).Select_
 
  Var Pic as String = "D:\user\Xojo\Eugene\Excel2019\Chapter19\150x150-72dpi.png"  //Path to picture
 
  Var ws as ExcelWorksheet
  ws = excel.ActiveWorkbook.ActiveSheet
 
  ws.Shapes.AddPicture(Pic, _ //Filename
  Office.msoFalse, _ //Link to file
  Office.msoTrue, _ //Save With Document
  excel.ActiveCell.Left, _ //Left Parameter
  excel.ActiveCell.Top, _ //Top Parameter
  -1, _ //Width (-1 = keep original size)
  -1) //Height (-1 = keep original size)
  ws.Shapes(1).Name = "MyPic"
 
  //Add a Hyperlink to the shape
  excel.ActiveSheet.Hyperlinks.Add(excel.ActiveSheet.Shapes("MyPic"), "https://www.scispec.ca", "SciSpec", "Scientific Specialties")
End Sub
3 Likes

Thanks Eugene,
As you are a great and generous guy you have already brought me the solution by mail and I hope it will be useful for others.
Thank you so much.

1 Like