How to add a hyperlink to a userform VBA Excel
How to add a hyperlink to a userform VBA Excel
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:enquiries@computergaga.com", NewWindow:=True Unload Me End Sub
The link is handled by the FollowHyperlink method. Be sure to modify the address as required.
The Unload Me statement closes the form.
Watch the Video
#evba #etipfree #eama #kingexcel
📤How to Download ebooks: https://www.evba.info/2020/02/instructions-for-downloading-documents.html?m=1
Leave a Comment