Results 1 to 6 of 6

Thread: [RESOLVED] Hyperlink text

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Resolved [RESOLVED] Hyperlink text

    I have searched the forum and havent found my answer so I am posting it here.


    On a form just like a website where you have the text which is hyperlinked, id like to have some text which is hyperlinked to an email address, can someone provide an example please?

    Thank you.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Hyperlink text

    And, when the email address is clicked, what would happen?

    Would you want that email address to be auto populated on the To: line of your default mail service?

  3. #3

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Hyperlink text

    errr please explain? Basically if a user clicks an email link then there email client will load pointing to the to: yes. Hopefully this isnt confusing.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Hyperlink text

    Presuming you are using a Label. If not, change accordingly
    Code:
    Option Explicit
    
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
    ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    Private Const SW_SHOWNORMAL = 1
    
    Private Sub Label1_Click()
    Dim MailMe As String
    MailMe = "mailto:" & Label1.Caption
    ShellExecute Me.hWnd, "open", MailMe, vbNullString, vbNullString, SW_SHOWNORMAL
    End Sub

  5. #5

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Hyperlink text

    ok added:

    Code:
    Private Sub Label1_Click()
    Dim MailMe As String
    MailMe = "mailto:[email protected]" & Label1.Caption
    ShellExecute Me.hWnd, "open", MailMe, vbNullString, vbNullString, SW_SHOWNORMAL
    End Sub
    When u click the label the email opens up but on the end of the email addy is the name of what I call the Label, which will cease to operate the email address.

    Any way around this?

  6. #6

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Hyperlink text

    Thank you. Worked it out removing the label and caption. Much appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width