Results 1 to 3 of 3

Thread: Hyper Link

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    NSW,Australia
    Posts
    34
    Can anyone tell me how to turn a text web address on a form into a hyper link

    Thanks

  2. #2
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    Code:
    'add this to the form
    Private Sub Command1_Click()
        Call ShellExecute(0&, vbNullString, "www.aol.com", vbNullString, vbNullString, vbNormalFocus)
    End Sub
    Code:
    'put this in a module
    Public 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
    [Edited by dimava on 08-29-2000 at 07:31 PM]
    NXSupport - Your one-stop source for computer help

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    assuming your text is the caption of label1
    
    'bas module code
    
    Option Explicit
    
    '
    Public 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
    
    Public Function ShellToBrowser%(Frm As Form, _
    ByVal URL$, ByVal WindowStyle%)
        
        Dim api%
            api% = ShellExecute(Frm.hwnd, "open", URL$, "", _
            App.Path, WindowStyle%)
     
        'Check return value
        If api% < 31 Then
            'error code - see api help for more info
            Dim msg As String
            msg = "This item doesn't work with your system"
            MsgBox msg, vbCritical, "Error"
            ShellToBrowser% = False
        ElseIf api% = 32 Then
            'no file association
            Dim msg1 As String
            msg1 = "This item doesn't work with your system"
            MsgBox msg, vbCritical, "Error"
            ShellToBrowser% = False
        Else
            'It worked!
            ShellToBrowser% = True
     
        End If
        
    End Function
    '
    
    'form code
    Option Explicit
    
    
    Private Sub Label1_Click()
        Dim Site As String
        Dim success As Integer
            Site = Label1.Caption
            success% = ShellToBrowser(Me, Site, 0)
    End Sub
    'you can post and ask how to change the cursor to a hand
    'kedaman posted it as an answer so he may be able to point you to it

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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