Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Deleting a File

Hi

The last part of my macro is a save command:
ActiveWorkbook.SaveAs
Filename:="H:\Personal\SIGINCUSTODY.csv", FileFormat _
:=xlCSV, CreateBackup:=False

I have a problem, however, in so far as a file of this
name already exists and I want to either:
a) overwrite it automatically (without being asked),or
b) delete it at the start of my macro.

The second option is my preferred option.

Can anyone show me how to do it ?

Thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
jd jd is offline
external usenet poster
 
Posts: 91
Default Deleting a File

Kill "H:\Personal\SIGNCUSTODY.csc"



"Steve" wrote:

Hi

The last part of my macro is a save command:
ActiveWorkbook.SaveAs
Filename:="H:\Personal\SIGINCUSTODY.csv", FileFormat _
:=xlCSV, CreateBackup:=False

I have a problem, however, in so far as a file of this
name already exists and I want to either:
a) overwrite it automatically (without being asked),or
b) delete it at the start of my macro.

The second option is my preferred option.

Can anyone show me how to do it ?

Thanks in advance


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Deleting a File

Hi Steve

Look in the VBA help for the Kill command

Sub test()
If Dir("C:\rrr.xls") < "" Then
Kill "C:\rrr.xls"
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steve" wrote in message ...
Hi

The last part of my macro is a save command:
ActiveWorkbook.SaveAs
Filename:="H:\Personal\SIGINCUSTODY.csv", FileFormat _
:=xlCSV, CreateBackup:=False

I have a problem, however, in so far as a file of this
name already exists and I want to either:
a) overwrite it automatically (without being asked),or
b) delete it at the start of my macro.

The second option is my preferred option.

Can anyone show me how to do it ?

Thanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Deleting a File

Thanks very much

-----Original Message-----
Kill "H:\Personal\SIGNCUSTODY.csc"



"Steve" wrote:

Hi

The last part of my macro is a save command:
ActiveWorkbook.SaveAs
Filename:="H:\Personal\SIGINCUSTODY.csv", FileFormat _
:=xlCSV, CreateBackup:=False

I have a problem, however, in so far as a file of this
name already exists and I want to either:
a) overwrite it automatically (without being asked),or
b) delete it at the start of my macro.

The second option is my preferred option.

Can anyone show me how to do it ?

Thanks in advance


.

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
Deleting a file Jo[_3_] Excel Discussion (Misc queries) 1 March 29th 09 02:50 AM
deleting a file Abhishek kedia Excel Discussion (Misc queries) 1 April 22nd 06 02:49 PM
Deleting a file from within Excel Night Owl Excel Worksheet Functions 3 May 14th 05 04:10 PM
Deleting file while in use Todd Huttenstine Excel Programming 1 April 29th 04 07:39 PM
Deleting a file using VB Rohit Thomas Excel Programming 3 July 14th 03 09:11 PM


All times are GMT +1. The time now is 12:18 PM.

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"