How can I attach a file with the current date to mail message?

I am developing my first bot and I have an excel application scope that does a save as and saves the workbook with the same name but the current date at the end. I created a variable for current date mm.dd.yyyy. This will run daily.
However, where I am getting stuck is on attach files. After it creates the file it emails the newly created file using the activity Send Outlook Mail Message. I would like to attach the file with the name + current date. I keep getting an error. How can I do this?
Thanks!
Scarlett

@sdickson Try this name+Now.ToString(“mm.dd.yyyy”)

1 Like

I am still getting an error “Send Outlook Mail Message: Cannot find this file. Verify the path and file name are correct.”
Within the Send Outlook Mail Message activity in Attach Files I have Direction In, Type String, Value “file path with file name (without date or .xlsm at the end)” + currentDate (name of my formatted now variable).
example
“\File Path\File Name”+current date
*The file name ends with the date.xlsm and I have deleted that from the path.

Hi,

Try like this,

“\File Path\File Name”+Now.ToString(“MM.dd.yyyy”)+".xlsm"

the date format should be MM.dd.yyyy if your Month representing numeric.

2 Likes

Hi,
Correct me if i am wrong,
The file name should be like yourfilename28/02/2019.xlsx.
Is this what you are looking for?

Regards,
Pavan H

1 Like

This worked! Thank you all so much! :man_dancing:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.