' ย https://www.myonlinetraininghub.com/excel-forum/vba-macros/delete-specific-files-in-a-folder
Sub Trashit()
Rem 1 Workbooks info
Const Ext As String = "xlsx"
Const FldrPth As String = "C:\BookData\AR"
'Dim FldrPth As String: Let FldrPth = ThisWorkbook.path ' can be used if macro is in file in same filder as files to be killded
Dim arrNms() As Variant: Let arrNms() = Array("Sheet2", "DCH") ' <--- ย This can it be also be got from other lists programatically maybe
Rem 2 Do it
Dim StearIsIt As Variant ' For each of it is in Variant type
ย ย For Each StearIsIt In arrNms()
ย ย ย ย If Len(Dir(FldrPth & Application.PathSeparator & StearIsIt & "." & Ext & "", vbNormal)) > 0 Then Kill FldrPth & Application.PathSeparator & StearIsIt & "." & Ext
ย ย Next StearIsIt
End Sub
ย
Comments
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐