Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
code to delete module / macro in another file Ray Clark[_2_] Excel Discussion (Misc queries) 1 July 3rd 08 04:15 AM
Code to delete an Excel File Ray Clark[_2_] Excel Discussion (Misc queries) 2 June 19th 08 11:22 PM
save and delete a file when in it with code Damien Excel Programming 1 August 8th 06 11:17 AM
code to delete a file Pradip Jain Excel Programming 3 April 29th 05 05:43 AM
i need help making code that will open an Xml file for Excel in VB.NET and delete tables that i don't want to show up sidewayz Excel Programming 0 March 3rd 04 03:26 PM


All times are GMT +1. The time now is 07:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"