![]() |
Skipping Folders
My question I believe is fairly simple. I am pulling filenames from a
directory but the next thing I have to do is pull file names from a specific folder of each supplier. The folders I am trying to pull from have the same name. I was using this code for just one folder. ______________________________________ Sub DIRECTORY() With Application.FileSearch .NewSearch .LookIn = "Q:\Eng\LIBRARY\DRAWINGS" .SearchSubFolders = True .Filename = "*.dwg*" .FileType = msoFileTypeAllFiles If .Execute() 0 Then MsgBox "There were " & .FoundFiles.Count & _ " file(s) found." For i = 1 To .FoundFiles.Count ActiveSheet.Cells(i + 1, 1).Value = _ .FoundFiles(i) Next i Else MsgBox "There were no files found." End If End With End Sub __________________________________________________ ______________ Now I wanna make an "in between" variable or function to skip the supplier folder so I dont have to go through each and every one. I need to get into the Inserts folder of each supplier basically. __________________________________________________ _______________ Sub DIRECTORY() With Application.FileSearch .NewSearch .LookIn = "Q:\Eng\LIBRARY\Supplier\ **VARIABLE FOLDER HERE** \INSERTS\" .SearchSubFolders = True .Filename = "*.dwg*" .FileType = msoFileTypeAllFiles If .Execute() 0 Then MsgBox "There were " & .FoundFiles.Count & _ " file(s) found." For i = 1 To .FoundFiles.Count ActiveSheet.Cells(i + 1, 1).Value = _ .FoundFiles(i) Next i Else MsgBox "There were no files found." End If End With End Sub THANKS IN ADVANCE TOM M |
All times are GMT +1. The time now is 10:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com