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


Hello Oreg,

From your description of the data on the worksheet, it wasn't clear t
me if column J2:J35 contains URL address strings or actual hyperlink
(blue underlined text).

I am going to assume that the "hyperlinks" are URL string addresses
since you call the Shell command. I hope you will let me know if thi
isn't the case.



Code
-------------------
Private Sub CommandButton2_Click()
Dim sPath As String
Dim sURL As String
Dim dTaskID As Double
Dim i As Long
Dim txt As Control

If ListBox1.ListIndex = -1 Then
MsgBox "Please select a URL from the list."
Exit Sub
End If

i = Me.ListBox1.ListIndex + 2
sURL = Sheets("DATA").cells(i, 7).Value

'This will run the default browser. If Netscape isn't your default browser
'There is another way to do this callin the browser of your choice.
'If you want that code let me know.

Call Shell("rundll32.exe url.dll,FileProtocolHandler " & sURL, vbNormalFocus)

End Sub

-------------------


If you have any questions, corrections, or need further help, contac
me at .

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=47739