autodestruction

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I try to protect my file from users modifying data.
Is there a way I can delete a file when I see they have change the data according to a specific date ??
I know it is strange but I need this to avoid corrupted files

TK
Douvid
 
Douvid said:
Is there a way I can delete a file when I see they have change the data
according to a specific date ??

Not sure what you mean by "according to a specific date"
In VBA you can find out the "last modified" date for a file using the FileDateTime function.
If the file is open (other than read-only) in Excel then this date will be misleading as it is
set to when the file was opened.

You can use the Kill statement to delete a file.

So

If FileDateTime("C:\MyFile.ext")>DateSerial(2003,1,1) Then
Kill "C:\MyFile.ext"
End If


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup
 
Back
Top