Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting a file | Excel Discussion (Misc queries) | |||
deleting a file | Excel Discussion (Misc queries) | |||
Deleting a file from within Excel | Excel Worksheet Functions | |||
Deleting file while in use | Excel Programming | |||
Deleting a file using VB | Excel Programming |