delete a file in code
How to delete a file in code? I dont want to be asked if i wanted or not to
do it |
delete a file in code
Look up "Kill" in the Help.
NickHK "aidan" wrote in message ... How to delete a file in code? I dont want to be asked if i wanted or not to do it |
delete a file in code
Try:
sub DeleteFile() Application.DisplayAlerts =False If Dir("C:\my documents\File Name to be Deleted.xls") < "" Then _ Kill "C:\my documents\File Name to be Deleted.xls" Application.DisplayAlerts = True end sub Regards Corey |
delete a file in code
If you want to permanently and completely delete the file, use the Kill
statement. Note that Kill does not send the file to the Recycle Bin. The file is gone forever. If you want to delete the file, but put it in to the Recycle Bin, use the code on http://www.cpearson.com/excel/recycle.htm . -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "aidan" wrote in message ... How to delete a file in code? I dont want to be asked if i wanted or not to do it |
All times are GMT +1. The time now is 05:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com