hi Guys, I have a macro which send out an email from in Excel and attaches a PDF. code is
.Attachments. Add "\\zebra\Report Template_20220215\Report_20220215.pdf"
How do tweak the dates in the code so it changes everyday ? Is it needs to be Today -1 in this format ("YYYYMMDD")
Microsoft ExcelMicrosoft Office
Last Comment
Justin Smith
8/22/2022 - Mon
Bembi
Format$(now() -1,"YYYYMMDD") Now is a serial number which counts each da beginning at 01.01.1900, so if you substract 1 you get the date from yesterday. This should deliver the date sequence you can add to your path / filename
Justin Smith
ASKER
what is the new code then?
.Attachments. Add ""\\zebra\Report Template_" & Format$(Now() - 1, "YYYYMMDD") & "\Report_" & Format$(Now() - 1, "YYYYMMDD" ?
Now is a serial number which counts each da beginning at 01.01.1900, so if you substract 1 you get the date from yesterday.
This should deliver the date sequence you can add to your path / filename