Excel VBA Macro To Remove All Excel Files From a Desired Directory or Folder
'Macro To Remove Any Type of Files From a Desired Directory or Folder
'Let us suppose if you want to delete all excel files loacated in My Documents
'You can use the "KILL" statement and *(Asterisk) with file extension "*.xlsx" to delete all ".xlsx" File Types
!!!!!!---< Cautious....Be aware....Take Care....Before Using Kill Statment >---!!!!!!
Dim P As String
P = "C:\Documents and Settings\Administrator\My Documents"
Kill P & "\" & "*.xlsx"
'You Can Specify Your Desired Path Where Your Excel Files are Located
You can Delete any of Your Desired File Types From Desired Locations as Follows:
'To Delete Text Document(.txt)Files
'Kill P & "\" & "*.txt"
'To Delete Word Document(.docx)Files
'Kill P & "\" & "*.docx"
'To Delete Image(.bmp,.jpg)Files
'Kill P & "\" & "*.bmp"
'Kill P & "\" & "*.jpg"
'Please try to avoid the use of "Kill" statement in Your Macros,If You want delete some thing do it manually.