Hi all,
Kindly have a look to the code given below
*************** *************** *************** *************** *************** **
Public Function CountFiles(strD ir As String, Optional SubDir As
Boolean) As Long
With Application.Fil eSearch
.NewSearch
.LookIn = strDir
.FileName = "*.*"
.SearchSubFolde rs = SubDir
If .Execute 0 Then
CountFiles = .FoundFiles.cou nt
End If
For i = 1 To .FoundFiles.cou nt
Me.list1.AddIte m (.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\sub folder1\file1.d oc"
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