I am new to the VBA format of writing code and I have been researching how to get the current date to AUTO input into the Subject line of an email when commanded. I need to know how to complete the following task.
Subject line should read, "stuff stuff stuff TODAYS DATE" Body should read, "Person, (return; tab) Stuff stuff stuff TODAYS DATE"
Also, if its possible I would like it to auto attach a file from a specific location that will have the name of "TODAYS DATE.xlsx"
Todays date should be in the format of DDMMMYY.
I am currently using a very basic macro to create the email and add the text where I need it.
Sub STUFF() Dim msg As Outlook.MailItem Set msg = Application.CreateItem(olMailItem) msg.To = "EMAILS" msg.CC = "EMAILS" msg.Subject = "STUFF STUFF STUFF *DATE*" msg.Body = "PERSON, STUFF STUFF STUFF *DATE*" msg.Display Set msg = Nothing End Sub
Thanks for the help.
edit - For clarrification I have tried the following: Today's date in Outlook Mail Subject (2010/Quick Steps) https://stackoverflow.com/questions/9177199/getting-the-current-date-in-visual-basic-2008 https://stackoverflow.com/questions/4313730/current-date-in-outlook-subject-line And most of the other Google Results for any variation of the keywords "macro outlook 2010 current date"
edit 2 - Reason My end goal is to have a Macro command, that when selected, creates a new email with the To, CC, Subject, Body, and Attachment completed for me so that I can just edit a couple lines of daily changing information and send it off. This will only be used when needed and not everytime I need to send a new email.