fill list box with file names

  • Thread starter Thread starter mcnews
  • Start date Start date
how to fill list box with file names sorted by date - newest first.
tia,
mcnewsxp

Look at the VBA help for the Dir() function, and use a loop to fill a Table.
Use that table (or a query based on the table) as the Row Source for the
listbox.
 
1. What is the make of the table holding these names?
2. What is the name of the date field?
3. What is the name of the names field?
4. How many names are we talking about? A combo box might be a better choice.
 
Look at the VBA help for the Dir() function, and use a loop to fill a Table.
Use that table (or a query based on the table) as the Row Source for the
listbox.

so the file names have to go into a table before i can sort them. no
way to let the dir() command do it. ok, i get it.
 
mcnews said:
so the file names have to go into a table before i can sort them.

Not necessarily, but it may be the easiest.
no way to let the dir() command do it. ok, i get it.

You could potentially fill an array in memory from the results of calling
the Dir() function and the FileDateTime() function in a loop, and then sort
that array, and then use a list-filling function to fill the list box from
your array. But it would involve some moderately complex coding.
 
Back
Top