PC Review


Reply
Thread Tools Rate Thread

delete a file in code

 
 
=?Utf-8?B?YWlkYW4=?=
Guest
Posts: n/a
 
      3rd Nov 2006
How to delete a file in code? I dont want to be asked if i wanted or not to
do it
 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      3rd Nov 2006
Look up "Kill" in the Help.

NickHK

"aidan" <(E-Mail Removed)> wrote in message
news:961381A6-0A29-464E-A9BE-(E-Mail Removed)...
> How to delete a file in code? I dont want to be asked if i wanted or not

to
> do it



 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      3rd Nov 2006
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


 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      3rd Nov 2006
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" <(E-Mail Removed)> wrote in message
news:961381A6-0A29-464E-A9BE-(E-Mail Removed)...
> How to delete a file in code? I dont want to be asked if i wanted or not
> to
> do it



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
code to delete a file =?Utf-8?B?UHJhZGlwIEphaW4=?= Microsoft Excel Programming 3 29th Apr 2005 05:43 AM
Delete file with code lefrench Microsoft Access VBA Modules 1 19th Sep 2004 02:28 PM
delete a file with code giannis Microsoft Access Forms 3 22nd Oct 2003 02:42 AM
delete a file with code giannis Microsoft Access External Data 3 22nd Oct 2003 02:42 AM
delete a file with code giannis Microsoft Access 3 22nd Oct 2003 02:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:32 PM.