Timed Deleting of files in a folder. (1 Viewer)

PixelPixie

New member
Local time
Today, 14:28
Joined
Mar 15, 2017
Messages
2
Hello -

I apologise if this has been fully answered else where - I have checked several threads - and still a relative noob to this kind of VBA / Access. :D

Basically I want to be able to delete a file or files from a folder after a period of time.

I have come across this...:confused:

If Date() > 01/01/2099 Then
'Run your self destruct code here
On Error Resume Next
Kill "C:\Users\Ron\Test\*.*"
On Error GoTo 0

End If

End Sub

My questions are - would I need to leave my computer turned on and logged in to a database and is there a better way? I have looked into adding something to the VBA of the Excel file that will clear the data if it is opened after a specified time?

I am outputting a file to be used by our collections team that is only valid for a certain amount of time and not that I don't trust people.....

Any and all help greatly received. :)
 
Last edited:

sneuberg

AWF VIP
Local time
Today, 14:28
Joined
Oct 17, 2014
Messages
3,506
If you just want to delete files I suggest creating a batch file to delete the files and then schedule a task to run it. The computer would have to be on for the task to run at the scheduled time but I believe it can be in sleep mode.
 

PixelPixie

New member
Local time
Today, 14:28
Joined
Mar 15, 2017
Messages
2
Brilliant- thank you so much :)

I shall give that a try.
 

Users who are viewing this thread

Top Bottom