Check out the dir() function. Below is a dump from the Help Example. I've also executed a MS-DOS Dir command to get a list, then imported the list into a database table.
In terms of locating the file with today's date.. you can use the Instr() function to locate the "." then subtract the number of digits for the date. In the If condition of the loop, you can look for file names where mid(filename,Instr(...),x)... = Todays'date.. htwh...
' Display the names in C:\ that represent directories.
MyPath = "c:\" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
Do While MyName <> "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If MyName <> "." And MyName <> ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
Debug.Print MyName ' Display entry only if it
End If ' it represents a directory.
End If
MyName = Dir ' Get next entry.
Loop
Steve Medvid
"IT Consultant & Web Master"
e-Mail: Stephen_Medvid@GMACM.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.