Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I Have this simple macro that will list all the files in a folder including
all the subfolders Sub file_list() With Application.FileSearch ..NewSearch ..LookIn = "C:\My Documents\" ..SearchSubFolders = True ..Filename = "*.*" ..FileType = msoFileTypeAllFiles If .Execute() 0 Then For I = 1 To .FoundFiles.Count Cells(I, 1) = .FoundFiles(I) Next I Else Cells(I, 1) = "No files Found" End If End With End Sub The folder i am looking in being, in this case being C:\My Documents\ has many sub folders. I want it to list the files in all but two of them, is it possible to modify the code to exlcude two specified subfolders. Something along the lines of If .subfolder ="sub1" then goto next thanks in advance Hervinder |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to List the names of the subfolders present in the folder (path of folder is given in the textbox by user ) | Excel Programming | |||
Save file in a new folder, but create folder only if folder doesn't already exist? | Excel Programming | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Programming | |||
Exclude directory from .FileSearch | Excel Programming |