Thread: Listbox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gareth[_6_] Gareth[_6_] is offline
external usenet poster
 
Posts: 158
Default Listbox

Hi Harry,

One suggestion would be to create hyperlinks dynamically. i.e. when the
user selects a list box item create a hypertext hyperlink, follow it and
then delete it.

For example, assuming you have ListBox1 embedded on your worksheet,
place the below code in a VBA module.

Sub ListBox1_DoubleClick()

Dim HL As Hyperlink

With ActiveSheet.Shapes("List Box 1").OLEFormat.Object
If .List(.ListIndex) < "" Then
Debug.Print .List(.ListIndex)
'create a hyperlink in range A1, say
Set HL = ActiveSheet.Hyperlinks.Add _
(ActiveSheet.Range("A1"), .List(.ListIndex))
HL.Follow
HL.Delete
End If
End With

End Sub

HTH,
Gareth


harryward27 wrote:
[font=Times New Roman]::Good evening
I am trying to link data in a listbox within a form with excel to
external files,ie pdfs.

I can hyperlink cell value but not listbox values.

Can anybody help. :)
::