2 Ways to Auto Assign a Specific Color Category to the Outlook Tasks Sent to Others

If you wish Outlook to auto assign a specific color category to the tasks which have been sent to others, you can read this post. Here we’ll expose 2 methods to you.

To classify Outlook items, one of the most common ways is using color categories. For example, in order to more easily distinguish own tasks from the tasks owned by others, many users are accustomed to assigning a specific category to the tasks sent to the other persons. In this situation, it is a good idea to make Outlook auto undertake this mission. Now, here we will introduce 2 ways to get it.

Method 1: Process the Tasks in Default Tasks Folder

  1. At the very outset, start Outlook program.
  2. Then, trigger Outlook VBA editor with accordance to “How to Run VBA Code in Your Outlook“.
  3. Next, in the new window, put the code below into the “ThisOutlookSession” project.
Private WithEvents objTasks As Outlook.Items

'Works on the tasks in default Tasks folder
Private Sub Application_Startup()
    Set objTasks = Outlook.Application.Session.GetDefaultFolder(olFolderTasks).Items
End Sub

Private Sub objTasks_ItemChange(ByVal Item As Object)
    Dim objTask As Outlook.TaskItem
 
    Set objTask = Item
 
    'Change "John Smith" to your own mailbox username
    If objTask.Owner <> "John Smith" Then
       'Change "Red Category" to the specific color category
       If InStr(objTask.Categories, "Red Category") = 0 Then
          objTask.Categories = objTask.Categories & ", " & "Red Category"
       End If
 
       objTask.Save
    End If
End Sub

VBA Code - Process the Tasks in Default Tasks Folder

Note: Remember to modify the code as per the comments and your own case.

  1. After that, click into “Application_Startup” subroutine and press “F5”.
  2. Eventually, you can have a try.
  • Open a task in the default Tasks folder.
  • Then, click “Assign Task” button.Assign Task
  • Next, fill in the recipients in “To” field and click “Send” button.Send Task
  • After the task is sent, in task list, you can see that it has been assigned with the specific color category.Assign Specific Color Category to the Task Sent to Others

Method 1 has a limitation – it only works on the tasks in the default Tasks folder. If you want to process all the tasks, you can use the following Method 2 instead.

Method 2: Process All Outgoing Tasks

  1. First off, still in VBA editor, copy the following code to “ThisOutlookSession” project.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objTaskRequest As Outlook.TaskRequestItem
    Dim objTask As Outlook.TaskItem

    If TypeOf Item Is TaskRequestItem Then
       Set objTaskRequest = Item
 
       Set objTask = objTaskRequest.GetAssociatedTask(True)
 
       'Change "Red Category" to the specific color category
       If InStr(objTask.Categories, "Red Category") = 0 Then
          objTask.Categories = objTask.Categories & ", " & "Red Category"
          objTask.Save
       End If
    End If
End Sub

VBA Code - Process All Outgoing Tasks

  1. Since then, every time after you send a task to others, Outlook will auto apply a specific color category to this task, no matter which folder the task is in.Sent Task with Specific Color Category

Eliminate Chances of Outlook Data Loss

Maybe you have discovered the fact that Outlook is vulnerable. Hence, if you wish to eradicate the chances of Outlook data loss, you need take actions. For instance, you should back up Outlook files at regular intervals. Besides, you ought to keep a potent Outlook repair tool, such as DataNumen Outlook Repair, which can repair Outlook problems with ease.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql repair and outlook repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *