Create Task With Attachment (Public)

PHOTO EMBED

Thu Aug 05 2021 22:56:13 GMT+0000 (Coordinated Universal Time)

Saved by @cnewnham #vba

Sub ConvertSelectedMailtoTask() 

    Dim objTask As Outlook.TaskItem 

    Dim objMail As Outlook.MailItem 

     

    Set objTask = Application.CreateItem(olTaskItem) 

    Set objMail = Application.ActiveExplorer.Selection.Item(1) 

 

With objTask 

    .subject = objMail.subject 

    .StartDate = objMail.ReceivedTime 

    .Body = objMail.Body 'Add the message as an attachment 

    .Attachments.Add objMail 

    .Save 

End With 

 

    Set objTask = Nothing 

    Set objMail = Nothing 

End Sub 
content_copyCOPY