How to add a hyperlink to a userform VBA Excel - KING OF EXCEL


KINGEXCEL.INFO ( KING OF EXCEL ) Welcome KINGEXCEL.INFO - Nothing Is Unable ... About Excel Tricks, Learning VBA Programming, Dedicated Software, Accounting, Living Skills ...

Friday, April 24, 2020

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.
  1. Add a Label to the form and enter a caption.
  2. 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.
Modifying properties for the hyperlink
  1. 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:="", 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.
Userform with email hyperlink

Watch the Video

#evba #etipfree #eama #kingexcel
📤How to Download ebooks:

No comments:

Post a Comment