Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts

    VB: form button that opens a link in browser...

    hey hey
    .. hm can this be done in vb? if so .. how?
    thanks
    sir p

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    You bet you can, just dump this into your form and then copy the code thats in the Command1_Click() sub into the sub for the right button on your form.

    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 Sub OpenFile(sURL As String)
       Dim nRetVal As Long
       If sFile = "" Then Exit Sub
       ShellExecute nRetVal, "open", sURL, "", "", 1
    End Sub
    
    Private Sub Command1_Click()
        OpenFile "http://www.codingforums.com"
        
    End Sub
    OracleGuy

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Thanks alot man

    P


  •  

    Posting Permissions

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