Consider this:
BE CAREFULL ! this will without warning delete all Excel workbooks from said folder !!!!!!!
Sub deletefilename()
Dim fs As FileSearch
Dim fn As String
Dim rightsixfn As String
mypath = "C:\Production Files"
Set fs = Application.FileSearch
With fs
.LookIn = mypath
'.FileName = "*.*"
.FileType = msoFileTypeAllFiles
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
fn = .FoundFiles(i)
rightsixfn = Right(fn, 4)
If rightsixfn = ".xls" Then
Kill (fn)
End If
Next i
Else
MsgBox "There were no files found in " & mypath
End If
End With
End Sub
Thank you,
Dave Rattigan