View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Oreg[_47_] Oreg[_47_] is offline
external usenet poster
 
Posts: 1
Default Listbox selection follows hyperlink


Hi all,

I've created a form (with much needed help from those in this forum),
which displays a listbox listing data in 3 columns - A2:C35 in
sheets("DATA"). In Sheets("DATA") column J2:J35, I have a hyperlink
created from the data listed in columns A2:C35. My ultimate goal is to
be able to click on a row in my listbox in userform1 and press a command
button on the form that will open netscape and follow the hyperlink.
Here's what I have so far... Can anyone point me in the right direction
? Thanks so much for your time.

Private Sub CommandButton2_Click()
Dim sPath As String
Dim sURL As String
Dim dTaskID As Double
Dim i As Long
Dim txt As Control
i = Me.ListBox1.ListIndex + 2
sURL = Me.ListBox1.Value
Me.ListBox1.Value = Sheets("DATA").cells(i, 7).Value

sPath = "C:\Program Files\Netscape\Communicator\Program\netscape.exe"
'my browser

dTaskID = Shell(sPath & " " & sURL, vbNormalFocus)

If dTaskID = 0 Then
MsgBox "Could not open browser"
End If
End Sub

Oreg


--
Oreg
------------------------------------------------------------------------
Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195
View this thread: http://www.excelforum.com/showthread...hreadid=477391