PDA

View Full Version : listbox woes



ProteanBeing
02-15-2008, 02:25 PM
I have a listbox with file names in them. I have another listbox with the complete filenames(Drive Letter\folder\filename) in it. I would like to be able to click the first list box and have the corresponding second list item open. When both are visible (and i move the item of the second) it works. When i hide the second (which is my goal) then it does not get the complete filename. Please help.

mdmackillop
02-15-2008, 02:58 PM
Where do the listboxes get the file names. I can't see the need for two, from what you have described (but I could be wrong!)

Bob Phillips
02-15-2008, 03:52 PM
See http://www.contextures.com/xlDataVal02.html

ProteanBeing
02-15-2008, 06:00 PM
What I want to do is have a file name in a list box. For example one file might be C:\My Documents\Data Files\21002.txt The list box will have only 21002.dat but when the user clicks on the number it opens up the text file. (The files have different locations).

Ago
02-16-2008, 12:38 AM
you could use an array to do that, right?
if you use the listbox to show the filenames, when user clicks on name the macro finds the complete filename in the array.

i cant remember what that variable is called, but it tells you what line in the listbox is marked.
you use that variable to find in the array.

it should work

Bob Phillips
02-16-2008, 03:16 AM
Better to have a two column listbox, with only one visible. Load the first column with the short name, the second with the long name, and when they click, pick up the column two value.

ProteanBeing
02-18-2008, 12:11 PM
Yes xld I agree this would be the right idea but what I am stuck on is how to insert and remove a row from a multi-column listbox at will.