Consulting

Results 1 to 2 of 2

Thread: Flag an E-Mail as done via vba - completion date missing

  1. #1
    VBAX Newbie
    Joined
    Feb 2019
    Posts
    2
    Location

    Flag an E-Mail as done via vba - completion date missing

    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


  2. #2
    VBAX Newbie
    Joined
    Feb 2019
    Posts
    2
    Location
    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
    elmarvo
    Last edited by elmarvo; 02-08-2019 at 02:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •