Click here for important information about

Find Folder in VBA

April 19, 2010 at 14:13:00
Specs: Windows XP
Let a folder named 'test1' stored under "c:\temp". Can I search for files with wildcard (for e.g. c:\temp\test*\) using VBA code. Instead of mentioning test1 can I use test* if test2, test3 folder exist in same location.

See More: Find Folder in VBA

April 19, 2010 at 14:42:03
Does it have to be VBA? Can you just execute a

dir test*.* /s

Report •

April 19, 2010 at 14:56:37
Go through the following Code:

Dim List_Files_In_Directory(10000, 1)
Dim One_File_List As String
Dim Number_Of_Files_In_Directory As Long

One_File_List = Dir$("C:" + "\temp\*.*")
Do While One_File_List <> ""
List_Files_In_Directory(Number_Of_Files_In_Directory, 0) = One_File_List
One_File_List = Dir$
Number_Of_Files_In_Directory = Number_Of_Files_In_Directory + 1

Number_Of_Files_In_Directory = 0
While List_Files_In_Directory(Number_Of_Files_In_Directory, 0) <> tom
Range("A5").Offset(Number_Of_Files_In_Directory, 0).Value = List_Files_In_Directory(Number_Of_Files_In_Directory, 0)
Number_Of_Files_In_Directory = Number_Of_Files_In_Directory + 1


In that we have to mention "Dir$("C:" + "\temp\*.*"). Is there any possibility to mention as te*p instead of mentioned temp

Report •
Related Solutions

Ask Question