Hello,
I am creating a simple macro with a part where the file gets saved with the current calendar week and a name from cell B2:
Path = "P:\Martin\LT"
filename = "LT CW02 " & Range("B2")
ActiveWorkbook.saveAs filename:=Path & filename & ".xlsm", FileFormat:=xlNormal
Above code works and it gets saved correctly, but every week I will have to change the code to the current calendar week. Is there a way how to change it so that I can use WeekNum function? I tried following but does not work:
filename = "LT CW" & WeekNum(TODAY(), 21) & Range("B2")
Probably I cannot use normal Excel functions in VBA code, but I am not sure how to work it out, as I have only basic knowledge of VBA so far.
Thank you for help.
Martin
Bookmarks