#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Listbox


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

I can hyperlink cell value but not listbox values.

Can anybody help. :)
:

--
harryward2
-----------------------------------------------------------------------
harryward27's Profile: http://www.excelforum.com/member.php...fo&userid=2549
View this thread: http://www.excelforum.com/showthread.php?threadid=38950

  #2   Report Post  
Posted to microsoft.public.excel.programming
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. :)
::


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Listbox


Harry maybe you could use indirect and write refs into a sheet then you
dont have to alter the code either.


--
robhargreaves
------------------------------------------------------------------------
robhargreaves's Profile: http://www.excelforum.com/member.php...o&userid=25519
View this thread: http://www.excelforum.com/showthread...hreadid=389501

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Listbox


Thank you for your replies.

I wanted not to put anything in any cells but I have changed tac on
the project.

I still would like to know if it is possible to link to listbox without
putting any thing in a cell.

Cheers :)


--
harryward27
------------------------------------------------------------------------
harryward27's Profile: http://www.excelforum.com/member.php...o&userid=25499
View this thread: http://www.excelforum.com/showthread...hreadid=389501

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Listbox

One of many ways is to just create a variable

Dim tbox1 as String

tbox1 = Userform1.Textbox1.Value


than do what ever you want with tbox1

--
steveB

Remove "AYN" from email to respond
"harryward27"
wrote in message
...

Thank you for your replies.

I wanted not to put anything in any cells but I have changed tac on
the project.

I still would like to know if it is possible to link to listbox without
putting any thing in a cell.

Cheers :)


--
harryward27
------------------------------------------------------------------------
harryward27's Profile:
http://www.excelforum.com/member.php...o&userid=25499
View this thread: http://www.excelforum.com/showthread...hreadid=389501





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Listbox

Hi Harry,

Do you mean that you want a hyperlink to "launch" when the user clicks
on the listbox item - and not mess about with the worksheet at all?
(Although it might be nicer to have them select a link and click ok.)

You could place the below code in a VBA module (as before). This code
just launches Acrobat and whatever file is in the listbox. There may
well be a tidier way to launch Acrobat thouhg.

Sub ListBox1_DoubleClick()

Dim AcroID As Double

With ActiveSheet.Shapes("List Box 1").OLEFormat.Object
If .List(.ListIndex) < "" Then
AcroID = _
Shell("c:\program files\adobe\acrobat 6.0\reader\acrord32.exe " _
& .List(.ListIndex), vbNormalFocus)
AppActivate AcroID
End If
End With

End Sub

HTH,
Gareth


harryward27 wrote:
Thank you for your replies.

I wanted not to put anything in any cells but I have changed tac on
the project.

I still would like to know if it is possible to link to listbox without
putting any thing in a cell.

Cheers :)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
Multicolumn Listbox and ordinary listbox Ron_D Excel Programming 0 June 4th 04 08:56 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"