Results 1 to 4 of 4
  1. #1
    Mike B
    Guest

    Hyperlink question...

    Hi ALL...I am trying to get a command button to open a website but the following code hangs on the .follow command...any suggestions or insights....could it be that I am using netscape as my default browser?

    Private Sub cmdWeb_Click()

    CreateHyperlink Me!cmdWeb, Me!txtSubAddress, Me!txtAddress
    End Sub

    Sub CreateHyperlink(ctlSelected As Control, _
    strSubAddress As String, Optional strAddress As String)
    Dim hlk As HyperLink
    Select Case ctlSelected.ControlType
    Case acLabel, acImage, acCommandButton
    Set hlk = ctlSelected.HyperLink
    With hlk
    If Not IsMissing(strAddress) Then
    .Address = strAddress
    Else
    .Address = ""
    End If
    .SubAddress = strSubAddress
    .Follow
    .Address = ""
    .SubAddress = ""
    End With
    Case Else
    MsgBox "The control '" & ctlSelected.Name _
    & "' does not support hyperlinks."
    End Select

    End Sub
    TIA

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Hyperlink question...

    Hi Mike,
    What have you got in the txtAddress and txtSubAddress fields? I think your code as it is will only link to objects in your database unless you specify the txtAddress.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Mike B
    Guest

    Re: Hyperlink question...

    they are both web addresses

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Hyperlink question...

    Have you put the http:// (or whatever) in front of the web address? (You need to.)
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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