Got a code but trying to delete all csv in folders and subfolders but getting error message
Set fs = Application.FileSearch
Object doesn't support this action runtime 445 as above
Can anyone assist what is going wrong
Set fs = Application.FileSearch
Object doesn't support this action runtime 445 as above
Can anyone assist what is going wrong
Code:
Sub delkillcsv()
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Users\obbdg\Desktop"
.SearchSubFolders = True
.Filename = "*.csv"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Kill .FoundFiles(i)
Next i
MsgBox .Filename & " " & .FoundFiles.Count & " No. files found."
Else
MsgBox "There were no files found."
End If
End With
End Sub