Share via

Hyperlinking a text box on a userform using VBA code

Anonymous
2013-04-10T16:09:43+00:00

Good afternoon

I have a text box on a user form which looks at 2 other combo boxes using If.. And..Then.  Depending on the result it will then go and return an entry from a cell on a worksheet.

That works fine and it returns the correct entry depending on the other 2 combo boxes.

The answer it returns is a website address and I would like it to be a hyperlink on the form enabling the user to click and go off to the appropriate website.

I've tried with the cell set on the worksheet as a hyperlink but it does not following through to the user form. 

Below is my present code for this, can you advise how to modify it to then make it an active hyperlink on the form please.

If Me.ComboBoxProductType = "Basic Liability (Builders, Plumbers, Painters etc.)" And Me.ComboBoxInsuranceCompany = "Ageas" Then

              Me.TextBoxWebAddress = Range("website!B2").Value

End If

Regards

Carl Larner

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. HansV 462.6K Reputation points MVP Volunteer Moderator
    2013-04-10T16:51:33+00:00

    Text boxes on a userform don't act as hyperlinks.

    You could add a command button with the following line in its On Click event procedure:

        ActiveWorkbook.FollowHyperlink Me.TextBoxWebaddress

    Alternatively, use a label, set its Caption property to the website address and use the above line in the On Click event procedure of the label.

    If you make the caption blue and underlined, it will even look like a hyperlink.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-04-10T16:49:56+00:00

    Try the FollowHyperlink method of the workbook.

    ThisWorkbook.FollowHyperlink Me.ComboBoxInsuranceCompany.Value

    1 person found this answer helpful.
    0 comments No comments