Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2014, 06:41 AM
megatronixs megatronixs is offline show folders and files in listbox Windows 7 32bit show folders and files in listbox Office 2003
Advanced Beginner
show folders and files in listbox
 
Join Date: Aug 2012
Posts: 42
megatronixs is on a distinguished road
Default show folders and files in listbox

Hi all,



I have a listbox that with the push of a button shows me all the files in the folder. The path is hard coded. I would like to avoid hard code all the folders so when I push a button, it shows the files from that folder.
Is there a way the code could be adjusted so it would show the folders and files in one listbox like below:

Folder1
file1
file2
Folder2
file1
file2.

This is the code I have now:

Code:
Private Sub Command23_Click()
    Dim LoadFiles   As String
    Dim strFill     As String
    
    LoadFiles = Dir$("C:\Messages\*.*")
    Do While LoadFiles > ""
       strFill = strFill & LoadFiles & ";"
       LoadFiles = Dir$
    Loop
    List21.RowSource = strFill
End Sub
greetings.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel Programming 14 08-18-2014 08:14 PM
list folders and files using .vbs file josianne Excel Programming 3 08-18-2014 03:03 PM
show folders and files in listbox This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel 1 08-08-2014 09:41 AM
copy, sync files across 2 folders 1 pc spgprivate Office 0 06-20-2013 08:41 AM
Outlook folders default show most recent message gregp Outlook 0 04-16-2013 12:56 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft