Home » excel » How to add a Hyperlink to a tab in Excel?

How to add a Hyperlink to a tab in Excel?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I want to add a hyperlink to a Tab in Excel. Actually I want to do it as an Excel Add in?
But now it seems there is not option for it by customizing ribbon directly. I know there is document location with a drop down list. But I want a link to a URL. From what I know hyperlinks can be placed on cells only. Please give me some ideas.

How to&Answers:

What is a hyperlink, really? Its a text “button” that, when clicked, brings you to a website or opens a link of some sort.
So in this case, use a button in a tab on the Excel ribbon that when clicked brings you to a website. Easy:

Private Sub MyRibbonButton_Click(Byval sender as Object, Byval e as EventArgs) Handles MyRibbonButton.Click

System.Diagnostics.Process.Start("my website url")

End Sub

Does it look like a button? Of course, but essentially it’s just a hyperlink, right?

Answer:

Use a CustomUI to create buttons for macros:

'To send email
'Callback for customButton onAction
Sub MyWeb(control As IRibbonControl)
Dim oShell As Object
Set oShell = CreateObject("Wscript.Shell")
    oShell.Run ("http://www.plugpro.com.br")
End Sub

'To Open URL
'Callback for customButton onAction
Sub MyWeb(control As IRibbonControl)
Dim oShell As Object
Set oShell = CreateObject("Wscript.Shell")
    oShell.Run ("mailto:[email protected]")
End Sub