ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Deleting a file via a macro (https://www.excelbanter.com/excel-discussion-misc-queries/205297-deleting-file-via-macro.html)

Sarah at DaVita

Deleting a file via a macro
 
I need to delete a file before I start up a macro. I want to just have this
as part of the macro I run. I don't understand how to use the deleteFile
method. The file I want to delete is C:\StoreTabFile.XLS. The help screen
mentions a FileSystemObject but I do not know what that is. Can someone help
me out?

Jim Thomlinson

Deleting a file via a macro
 
You need to use the kill function...

Kill "C:\StoreTabFile.XLS"

--
HTH...

Jim Thomlinson


"Sarah at DaVita" wrote:

I need to delete a file before I start up a macro. I want to just have this
as part of the macro I run. I don't understand how to use the deleteFile
method. The file I want to delete is C:\StoreTabFile.XLS. The help screen
mentions a FileSystemObject but I do not know what that is. Can someone help
me out?


Rick Rothstein

Deleting a file via a macro
 
VB has a Kill command that you should be able to use. Try this line...

Kill "C:\StoreTabFile.XLS"

--
Rick (MVP - Excel)


"Sarah at DaVita" .(donotspam) wrote in message
...
I need to delete a file before I start up a macro. I want to just have
this
as part of the macro I run. I don't understand how to use the deleteFile
method. The file I want to delete is C:\StoreTabFile.XLS. The help
screen
mentions a FileSystemObject but I do not know what that is. Can someone
help
me out?



Sarah at DaVita

Deleting a file via a macro
 
What do I put in there to tell the macro to continue if it cannot find the
file to kill?

"Jim Thomlinson" wrote:

You need to use the kill function...

Kill "C:\StoreTabFile.XLS"

--
HTH...

Jim Thomlinson


"Sarah at DaVita" wrote:

I need to delete a file before I start up a macro. I want to just have this
as part of the macro I run. I don't understand how to use the deleteFile
method. The file I want to delete is C:\StoreTabFile.XLS. The help screen
mentions a FileSystemObject but I do not know what that is. Can someone help
me out?


Jim Thomlinson

Deleting a file via a macro
 
On error resume next
Kill "C:\StoreTabFile.XLS"
on error goto 0

--
HTH...

Jim Thomlinson


"Sarah at DaVita" wrote:

What do I put in there to tell the macro to continue if it cannot find the
file to kill?

"Jim Thomlinson" wrote:

You need to use the kill function...

Kill "C:\StoreTabFile.XLS"

--
HTH...

Jim Thomlinson


"Sarah at DaVita" wrote:

I need to delete a file before I start up a macro. I want to just have this
as part of the macro I run. I don't understand how to use the deleteFile
method. The file I want to delete is C:\StoreTabFile.XLS. The help screen
mentions a FileSystemObject but I do not know what that is. Can someone help
me out?


Sarah at DaVita

Deleting a file via a macro
 
THANKS!!!!!

"Jim Thomlinson" wrote:

On error resume next
Kill "C:\StoreTabFile.XLS"
on error goto 0

--
HTH...

Jim Thomlinson


"Sarah at DaVita" wrote:

What do I put in there to tell the macro to continue if it cannot find the
file to kill?

"Jim Thomlinson" wrote:

You need to use the kill function...

Kill "C:\StoreTabFile.XLS"

--
HTH...

Jim Thomlinson


"Sarah at DaVita" wrote:

I need to delete a file before I start up a macro. I want to just have this
as part of the macro I run. I don't understand how to use the deleteFile
method. The file I want to delete is C:\StoreTabFile.XLS. The help screen
mentions a FileSystemObject but I do not know what that is. Can someone help
me out?



All times are GMT +1. The time now is 08:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com