erik.van.geit
MrExcel MVP
- Joined
- Feb 1, 2003
- Messages
- 17,832
Dear Excellers,
running this code, Excel finds files that were deleted previously, and doesn't find files added recently - even after restarting computer
Excel finds phantoms !? Excel's filedetection doesn't work good ?!
probably the experts will find a mistake in this code
Or don't you have this phantom problems?
kind regards,
Erik
running this code, Excel finds files that were deleted previously, and doesn't find files added recently - even after restarting computer
Excel finds phantoms !? Excel's filedetection doesn't work good ?!
probably the experts will find a mistake in this code
Code:
Sub find_files()
With Application.FileSearch
.NewSearch
.LookIn = ThisWorkbook.Path & "\"
.SearchSubFolders = True
.Filename = "*.xls"
.FileType = msoFileTypeOfficeFiles
If .Execute() > 0 Then
For I = 1 To .FoundFiles.Count
If MsgBox("Do you want to delete this file ?" & Chr(10) & .FoundFiles(I), 36, "DELETE FILE") = vbYes Then
Kill .FoundFiles(I)
End If
Next I
End If
End With
End Sub
kind regards,
Erik