Excel VBA Macro To Remove All Excel Files from a Desired Directory or Folder
!!!!!!---< Cautious....Be aware....Take Care....Before Using Kill Statment >---!!!!!!
'Macro
To Remove Any Type of Files From a
Desired Directory or Folder
'Let
us suppose if you want to delete all excel files located 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 >---!!!!!!
Sub
DelAllMyXlFiles()
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
Notes:
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"
End
Sub
Warning:
'Please try to avoid the use of "Kill" statement in Your Macros,If You want delete some thing do it manually.
Thanks, TAMATAM
No comments:
Post a Comment
Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.