Outlook Macro to send message: Need date insertion in Subject and Body
Posted on 2006-07-21
I have an Outlook macro that I found on expert exchange that works great. It just sends an email when I click on it on the toolbar. I want to add the current date to the subject line and body of the macro. Here it is;
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
' By default person will be added
' to the To area
.Subject = "Daily Report for <date needed here>"
' Touching body makes it an RTF message
.Body = "Somebody - The Daily Report for <date needed here> has been executed and printed. Thanks - PVsupport"
' Touching HTMLBody makes it HTML
'.HTMLBody = "This is the body in HTML."
' Send it
' Display it
Set objMail = Nothing
I have found various ways of getting the date on the forums but I am not sure of the syntax to work it into the macro
(I'm a Perl guy, not VB :)