.msg file, set %date% to be autocompleted

celtician used Ask the Experts™
I have some .msg file, it has a date in the subject (day of the week and day of the month) and also in the message body, i need it to be completed automatically for the given day.

ie. if today is monday, when i open the .msg file, i need it to display - monday 07/13/2015 instead of writing it myself everyday.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

This does not make sense. MSG files are static copies of mail messages, no dynamic content. Imagine the subject would change each time you open a stored message?!
Alexei KuznetsovMicrosoft Outlook MVP

Agreed with Qlemo. What do you exactly do with this MSG file? You open it, change the date manually and then what? Just save it back?


OH ok i didn't know it couldn't be dynamic.

I need to send it... with the current date.

What option would you suggest for that?
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
An Outlook VBA macro, called on message send, can do that. It would run for all mail you send, though.

Put this into your ThisOutlookSession module in VBA Editor (Alt-F11), then restart Outlook, and test.
Public WithEvents olApp As Outlook.Application 

Public Sub Application_Startup()
  set olApp = Outlook.Application
End Sub

Private Sub olApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Item.Subject = Replace(Item.Subject, "%date%", date)
  Item.Body    = Replace(Item.Body   , "%date%", date)
End Sub

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial