• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

How to add an hyperlink to a VB form?

I would like to know how to add an hyperlink in a form
0
dimensionav
Asked:
dimensionav
  • 2
1 Solution
 
MetallimirkCommented:
Here is an answer from a PAQ:

Add a label with the following properties:

Name = lblHyperLink
Font set Underline
ForeColor = Blue
MousePointer = 10 - Up Arrow

And add this code:

Private Sub lblHyperLink_Click()
  Const cLinkVisited As Long = vbMagenta
 
  Shell ("cmd /c " & Chr$(34) & "Start " & lblHyperLink.Caption & Chr$(34))
 
  lblHyperLink.ForeColor = cLinkVisited
End Sub
0
 
Chris MillardCommented:
I add a label to my form and double click on it, then in the code section, I add:-

ShellDocument "http://www.webaddress.com"

Of course, you should change the label text colour to dark blue and perhaps underline it too so it looks like a hyperlink
0
 
Chris MillardCommented:
Oh, and using the same as my comment above, you can use the mailto feature, such as:-

ShellDocument "mailto:someone@somedomain.com"

0
 
dimensionavAuthor Commented:
I tried ShellDocument instruction but I got an error during compilation
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now