LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Folder List

Hi to All,
This macro gets the name of the files in a folder "My Documents" to a excel
sheet,
can it be improved/altered to get the name of the sub folders in it?
Regards,
Cecil

Sub FileListing()
Dim oFSO As Object
Dim oFolder As Object
Dim oFile As Object
Dim a As Long
Dim sOld As String

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder("C:\My Documents")

a = 2
For Each oFile In oFolder.Files
sOld = oFile.Name
Range("A" & a) = sOld
a = a + 1
Next oFile

End Sub


 
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
create a file list from a folder? Hal239 Excel Discussion (Misc queries) 2 February 5th 09 03:32 PM
How do I print a LIST of documents in a folder littlebear20 Excel Discussion (Misc queries) 2 August 16th 06 11:44 PM
folder list Franky Excel Programming 0 September 8th 04 10:39 AM
list Workbooks in Current Folder jC! Excel Programming 4 December 27th 03 01:12 AM
How to get the list of files in a folder yang Excel Programming 1 October 16th 03 12:53 PM


All times are GMT +1. The time now is 10:36 PM.

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

About Us

"It's about Microsoft Excel"