Hi all,
Kindly have a look to the code given below
************************************************** ***************************
Public Function CountFiles(strDir As String, Optional SubDir As
Boolean) As Long
With Application.FileSearch
.NewSearch
.LookIn = strDir
.FileName = "*.*"
.SearchSubFolders = SubDir
If .Execute 0 Then
CountFiles = .FoundFiles.count
End If
For i = 1 To .FoundFiles.count
Me.list1.AddItem (.FoundFiles(i))
Next i
End With
End Function
************************************************** **********************
you must have understood that this code is helping me to count the
number of files in a given folder and adding the names of those files
in a listbox.
It is adding the file name in the list box as
"I:\folder1\subfolder1\file1.doc"
but i want the name to be added in the list box as "file1.doc"
My second question is , is it possible to open the same file in the
list box by double clicking the filename.
can any one give me the solution for the problem.
sam