Niharika
asked on
list Files with particular extension without using file list box
How to list Files with particular extension in a directory without using file list box?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim DirName As String ' Declare variables.
DirName = Dir(Path, 6) ' Get first file name.
Do While DirName <> ""
If DirName <> "." And DirName <> ".." Then
lstbox1.AddItem DirName ' Put Filename in list box.
End If
DoEvents
End If
DirName = Dir ' Get another file name.
Loop
hope this helps u,
Rgds,
Navstar16
DirName = Dir(Path, 6) ' Get first file name.
Do While DirName <> ""
If DirName <> "." And DirName <> ".." Then
lstbox1.AddItem DirName ' Put Filename in list box.
End If
DoEvents
End If
DirName = Dir ' Get another file name.
Loop
hope this helps u,
Rgds,
Navstar16
sorry i forgot to tell u
paths is actually ur dir path + file name or file patttern
eg. "c:\windows\*.dll"
or
app.path & "\*.txt"
Rgds,
Navstar16
paths is actually ur dir path + file name or file patttern
eg. "c:\windows\*.dll"
or
app.path & "\*.txt"
Rgds,
Navstar16
Dim myPath As String
Dim myName As String
myPath = "C:\my documents\"
myName = Dir(myPath & "*.txt") ' Retrieve the first entry.
Do While myName <> "" ' Start the loop.
Debug.Print myName
myName = Dir ' Get next entry.
Loop