Bram de Groot
New member
- Local time
- Today, 08:27
- Joined
- Feb 18, 2004
- Messages
- 7
I managed to list filenames using the following code:
With Application.FileSearch
.NewSearch
.LookIn = MyValue
.SearchSubFolders = True
.filename = ""
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
rstmdb.AddNew
rstmdb("FileName") = .FoundFiles(i)
rstmdb.Update
Next i
Else
MsgBox "There were no files found."
End If
End With
rstmdb.Close
This gives me a list of filenames with their path. Is there a way to list only the filenames?
Thanks!
Bram de Groot
With Application.FileSearch
.NewSearch
.LookIn = MyValue
.SearchSubFolders = True
.filename = ""
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
rstmdb.AddNew
rstmdb("FileName") = .FoundFiles(i)
rstmdb.Update
Next i
Else
MsgBox "There were no files found."
End If
End With
rstmdb.Close
This gives me a list of filenames with their path. Is there a way to list only the filenames?
Thanks!
Bram de Groot