I have some VBA that looks for a specific folder by the current year in this format YYYY and then names the excel file and saves it in that current year YYYY folder. Here is the code:
Usually the folder is always there but when the new year comes for 2025, instead of manually creating a folder every year, I was wondering if there was a way that if the YYYY folder does NOT exist, can it auto create one to save the file in it?
How would I write the VBA to do that if possible? Thanks for the help.
VBA Code:
ActiveWorkbook.SaveAs Filename:="K:\BACKEND\RECORDS\CLERK\" & Format(Now(), "YYYY") & "\" _
& "ABC_" & Format(Now(), "MM-DD-YYYY") & ".xlsm"
Usually the folder is always there but when the new year comes for 2025, instead of manually creating a folder every year, I was wondering if there was a way that if the YYYY folder does NOT exist, can it auto create one to save the file in it?
How would I write the VBA to do that if possible? Thanks for the help.