Search code examples
vbaoutlookrulesmailitem

Cannot Set Properties on MailItem


I have setup a rule to run yuno on anything with "Test1" as the subject (I restarted after setting this up): enter image description here

My code looks like this:

Sub yuno(ByRef mymail As MailItem)
    mymail.MarkAsTask olMarkToday
    mymail.TaskDueDate = Now
    mymail.ReminderSet = True
    Debug.Print "Y U NO?"
End Sub

"Y U NO" prints on receipt of an email with "Test1" as the subject, but it does not receive the little red flag in Outlook. Degustaf said that this code would correctly flag the item here: https://stackoverflow.com/q/26722857/2642059 But it appears that the problem is in running it as a rule.


Solution

  • I suggest there is a missing

    mymail.Save