Hello all. I have a list box and a command button. I want to highlight an item in the list box then click the command button and it will open a certain site? How do I do this? Thanks in advance I really appreciate the help :>)
Printable View
Hello all. I have a list box and a command button. I want to highlight an item in the list box then click the command button and it will open a certain site? How do I do this? Thanks in advance I really appreciate the help :>)
add a command button and a listbox, and this...
VB Code:
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 Form_Load() List1.AddItem "http://www.google.co.uk" List1.AddItem "http://www.vbforums.com" List1.AddItem "http://www.smartbarxp.com" Command1.Caption = "Go" End Sub Private Sub Command1_Click() ShellExecute Me.hwnd, "open", List1.List(List1.ListIndex), vbNullString, vbNullString, 1 End Sub