Note: The other languages of the website are Google-translated. Back to English

How to auto create a task when sending email in Outlook?

Sometimes, you may need to automatically create a task of an email when sending it in Outlook. Here we are providing a method for you to quickly get it done.

Auto create a task when sending email in Outlook with VBA

Auto create a task when sending email in Outlook with VBA

With the below VBA code, you can create a task automatically based on a sending email in Outlook. Please do as follows.

1. Launch your Outlook, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, copy the below VBA code into the ThisOutlookSession code window.

VBA code: Auto create a task when sending email in Outlook

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'Updated by Extendoffice 20181123
    Dim xYesNo As Integer
    Dim xPrompt As String
    Dim xTaskItem As TaskItem
    Dim xRecipient As String
    On Error Resume Next
    xPrompt = "Do you want to create a task for this message?"
    xYesNo = MsgBox(xPrompt, vbYesNo + vbInformation, "Kutools for Outlook")
    Cancel = False
    If xYesNo = vbNo Then Exit Sub
    Set xTaskItem = Application.CreateItem(olTaskItem)
    For Each Rcp In Item.Recipients
        If xRecipient = "" Then
            xRecipient = Rcp.Address
            xRecipient = xRecipient & vbCrLf & Rcp.Address
        End If
    Next Rcp
    xRecipient = xRecipient & vbCrLf & Item.Body
    With xTaskItem
        .Subject = Item.Subject
        .StartDate = Item.ReceivedTime
        .DueDate = Date + 3 + CDate("9:00:00 AM")
        .ReminderSet = True
        .ReminderTime = Date + 2 + CDate("9:00:00 AM")
        .Body = xRecipient
    End With
    Set xTaskItem = Nothing
End Sub

Note: The message recipients and the message body will be added into the task body automatically. The start date of the task is the sent date of the message, and the task will be due in 3 days. You will be reminded of the task at 9 am after one day. You can change them as you need.

3. Save the code and press the Alt + Q keys to close the Microsoft Visual Basic for Applications window.

4. From now on, when clicking the Send button in a new or a replied email window, a Create Task dialog box will pop up as below screenshot shown, click Yes to send the email and create a task automatically, or click No to send the email without creating task.

Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
Comments (3)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Is there a way to modify this as to include more of a link to the sent mail than just recipients & subject? ie. add the sent mail as attachment?
This comment was minimized by the moderator on the site

This worked for a few days and now it no longer works.

Is there a reason?
This comment was minimized by the moderator on the site
Hi Terri Amos,
Please enable the Enable all macros option and the Apply macro security settings to installed add-ins option as shown in the screenshot below. After that, restart your Outlook.
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations

Follow Us

Copyright © 2009 - | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL