• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microsoft Excel Tips and Tricks - Computergaga

  • Home
  • Excel Online Courses
  • Excel Functions List
  • Free Downloads
  • Blog
  • Tutorials
  • About
Home / VBA / Add a Hyperlink to a Userform – Excel VBA

Add a Hyperlink to a Userform – Excel VBA

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:="mailto:[email protected]", 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.

Excel VBA userform with a hyperlink

Watch the Video

Related Posts:

  • Compare dates in Excel feature
    How to Compare Dates in Excel
  • Calculate age in Excel thumbnail
    How to Calculate Age in Excel
  • SWITCH function feature
    Excel SWITCH Function - Nested IF Function Alternative
  • IMAGE function in Excel
    Excel IMAGE Function - Insert Images from a Cell Value

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • Excel SWITCH Function – Nested IF Function Alternative
  • Sum Formulas Only in Excel
  • How to Calculate Age in Excel
  • Custom Sort in Excel
  • Case Sensitive Lookup with XLOOKUP in Excel
Advanced Excel Success book

Footer

Contact

[email protected]

LinkedIn Twitter YouTube

Useful Links

  • Home
  • Excel Online Courses
  • Tutorials
  • Sitemap
  • Privacy Policy
  • Jobs by Jooble

Course Topics

  • Blog
  • Charts
  • Courses
  • Dashboards
  • Downloads
  • Excel Tips
  • Formulas
  • Mail Merge
  • Office
  • PivotTables
  • Power BI
  • Power Pivot
  • Power Query
  • VBA

Join Our Mailing List

© Copyright 2009 Computergaga · All Rights Reserved ·