PDA

View Full Version : [SOLVED:] Flag an E-Mail as done via vba - completion date missing



elmarvo
02-07-2019, 10:44 AM
Hello there,

whenever I manually check off an e-mail as done, there is a completion date showing.

But when I do it via Excel-VBA (see my code snippet below), there won't be any date of completion.

Am I missing something? I already tried to add .TaskCompletedDate = Date but that won't change anything.

Thank you

Regards
elmarvo


Sub MainSub()
CheckMail olMail, olFlagComplete, False
End Sub


Private Sub CheckMail(Mail As MailItem, Status As String, IsRead As Boolean, Optional Icon As String)

With Mail
.FlagStatus = Status
If Not Icon = vbNullString Then .FlagIcon = Icon
.UnRead = IsRead
.Save
End With

End Sub

elmarvo
02-08-2019, 02:38 AM
I've found the solution: I need to mark the MailItem as a task first, then there will be a date of completion.


Private Sub MarkMail(Mail As MailItem, Status As String, IsntRead As Boolean, Optional Icon As String)


With Mail
.MarkAsTask olMarkNoDate
.FlagRequest = "ToDo" 'Default="Follow up"
.FlagStatus = Status
If Not Icon = vbNullString Then .FlagIcon = Icon
.UnRead = IsntRead
.Save
End With

End Sub


Cheers :hi:
elmarvo