I have a .xlsm with the following code:
This folder holds files related to a daily process, but they only need to be kept the rest of the day. I would like to make a macro to purges the Directory created by "Current Year" and all subdirectories and files.
So in the case of 2020, I want it to kill C:\AUDITS\PROCESS\2020\*
It would be best if this "killed" them instead of just sending them to the recycle bin.
I can not find a way to get excel to do this, based on the code where the subdirectory is created by the Current Year function. It works if I directly make it 2020, but it needs to shift from year to year.
I hope this makes sense, but I cannot figure out how to get it to work.
Thanks in advance for any help!
VBA Code:
Dim strDir As String
strDir = "C:\AUDITS\PROCESS\" & CurrentYear & "\" & currentmonth & "\" & Format$(Date, "mm-dd-yyyy")
This folder holds files related to a daily process, but they only need to be kept the rest of the day. I would like to make a macro to purges the Directory created by "Current Year" and all subdirectories and files.
So in the case of 2020, I want it to kill C:\AUDITS\PROCESS\2020\*
It would be best if this "killed" them instead of just sending them to the recycle bin.
I can not find a way to get excel to do this, based on the code where the subdirectory is created by the Current Year function. It works if I directly make it 2020, but it needs to shift from year to year.
I hope this makes sense, but I cannot figure out how to get it to work.
Thanks in advance for any help!