Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
This is obviously a variation on a theme and I realise that the deleted file(s) will not move to the recycle bin. On the first business day of a new month ie March, I would like to delete all the files in a specific folder which are more than a month old, ie from Jan or before. I already have a procedure which runs only on the first business day of each month, so the additional code can be incoprorated into this. Thanks for your help. Regards Richard |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is obviously a variation on a theme and I realise that the deleted
file(s) will not move to the recycle bin. Okay, as long as you realize that the files will not be recoverable... On the first business day of a new month ie March, I would like to delete all the files in a specific folder which are more than a month old, ie from Jan or before. I already have a procedure which runs only on the first business day of each month, so the additional code can be incoprorated into this. TEST THE FOLLOWING AGAINST COPIES OF THE ACTUAL FILES FIRST to make sure it works correctly!!! ' Put these with the rest of your Dim statements Dim Path As String Dim FileName As String ' .... ' .... ' Note the trailing backslash... always include it. Path = "C:\TEMP\Test\" FileName = Dir$(Path & "*.*") Do While Len(FileName) 0 If DateDiff("m", FileDateTime(Path & FileName), #3/1/2008#) 1 Then Kill Path & FileName End If FileName = Dir$ Loop Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming |