If you have ever tried to add a hyperlink to a userform, you would have noticed that there is no hyperlink button on the toolbox.
You may not be able to insert a hyperlink like you would on an Excel spreadsheet, but you can create a link by inserting a label and applying the OnClick event.
Adding a Hyperlink to a Userform
In this example we will add a hyperlink so users may email an enquiries department from the userform.
- Add a Label to the form and enter a caption.
- You can format the label so that it looks like a typical hyperlink. For example, you can make the font blue, Courier New and underlined.
- Double click on the label to show the Click routine in the module window. Enter the code into the routine as shown below.
Private Sub lblLink_Click() ActiveWorkbook.FollowHyperlink Address:="mailto:[email protected]", NewWindow:=True Unload Me End Sub