Delete Excel Spreadsheet

M

Martin

Hi,

Is there any way to write a macro in Access to delete an
excel spreadsheet that is stored in a specific location?
Basically I am exporting some records to excel and doing
some bits and pieces to them. I then want that file
erased for data protection purposes.

Cheers

Martin
 
N

Nikos Yannacopoulos

Martin,

I do not know of a way to do this with a macro, but it is very easy to do it
with a single line of VB code.
Paste the following function in any existing Module, or create a new one:

Function Delete_WorkBook()
Kill "C:\SomeFolder\SomeWorkBook.xls"
End Function

Just change the string in quotes to the actual path and filename.

Then the function can be run form a macro using a RunCode action, with
argument Delete_WorkBook(), or from a command button on a form etc.

HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top