2 Ways to Print the Lists of Outlook Tasks with Different Categories in Different Pages

If you’ve assigned various color categories to your Outlook tasks and now want to print the lists of tasks with different categories in different pages, you can refer to this article. Here we will share you 2 methods to get it.

In order to classify and well manage your tasks, perhaps you have applied color categories to your tasks. Now, if you would like to print out the lists of your tasks with different categories in different pages, please read on. In the followings, we will introduce you 2 means to get it.

Method 1: Manually Print Task Lists One by One

  1. First off, in Outlook, access “Tasks” pane.
  2. Then, open a Task folder.
  3. Next, press “Ctrl + E” to activate “Search” ribbon.
  4. After that, on “Search” tab, click “Categorize” button.
  5. From the drop down list, choose a color category.Search by Category
  6. Then, only the tasks with the selected category will be left in the list.Only Tasks with Specific Color Category Are Left
  7. Now, go to “File” > “Print” to print out this task list.Print Found Tasks in List
  8. Subsequently, in the same way, print out the lists of tasks with the other color categories one by one manually.

Method 2: Batch Print the Task Lists by VBA

  1. At the very outset, trigger VBA editor with accordance to “How to Run VBA Code in Your Outlook“.
  2. Then, add the reference to “MS Excel Object Library” as per “How to Add an Object Library Reference in VBA“.
  3. Next, copy the following VBA code into a module.
Sub PrintTaskList_SpecificColorCategory()
    Dim objTasks As Outlook.Items
    Dim objTask As Outlook.TaskItem
    Dim objDictionary As Object
    Dim arrCategory As Variant
    Dim varCategory As Variant
    Dim objExcelApp As Excel.Application
    Dim objExcelWorkbook As Excel.Workbook
    Dim objExcelWorksheet As Excel.Worksheet
    Dim varKey As Variant
    Dim strKey As String
    Dim i As Long
    Dim bSheetFound As Boolean
    Dim nLastRow As Integer
    Dim objSheet As Excel.Worksheet
 
    Set objTasks = Application.Session.GetDefaultFolder(olFolderTasks).Items
    Set objDictionary = CreateObject("Scripting.Dictionary")
 
     'Get All Tasks' Categories
    For Each objTask In objTasks
        arrCategory = Split(objTask.Categories, ",")
        For Each varCategory In arrCategory
            If objDictionary.Exists(Trim(varCategory)) = False Then
               objDictionary.Add Trim(varCategory), 0
            End If
        Next
    Next
 
    'Export the Tasks with Different Categories into Different Sheet in an Excel Workbook
    Set objExcelApp = CreateObject("Excel.Application")
    Set objExcelWorkbook = objExcelApp.Workbooks.Add
    objExcelApp.Visible = True
 
    i = 0
    For Each varKey In objDictionary.Keys
        strKey = CStr(varKey)

        On Error Resume Next
        objExcelWorkbook.Sheets(strKey).Select
        bSheetFound = (Err = 0)
        On Error GoTo 0
        If bSheetFound = False Then
           i = i + 1
           If i < 4 Then
              Set objExcelWorksheet = objExcelWorkbook.Sheets(i)
           Else
              Set objExcelWorksheet = objExcelWorkbook.Sheets.Add(After:=objExcelWorkbook.Sheets(objExcelWorkbook.Sheets.Count))
           End If
           objExcelWorksheet.Name = strKey
        End If
 
        With objExcelWorksheet
             .Cells(1, 1) = strKey
             .Cells(1, 1).Font.Bold = True
             .Cells(1, 1).Font.Size = 18
             .Cells(2, 1) = "Subject"
             .Cells(2, 1).Font.Bold = True
             .Cells(2, 2) = "Start Date"
             .Cells(2, 2).Font.Bold = True
             .Cells(2, 3) = "Due Date"
             .Cells(2, 3).Font.Bold = True
        End With
 
        For Each objTask In objTasks
            If InStr(objTask.Categories, strKey) > 0 Then
               nLastRow = objExcelWorksheet.Range("A" & objExcelWorksheet.Rows.Count).End(xlUp).Row + 1
               With objExcelWorksheet
                    .Range("A" & nLastRow) = objTask.Subject
                    .Range("B" & nLastRow) = objTask.startDate
                    .Range("C" & nLastRow) = objTask.DueDate
               End With
            End If
        Next
 
        objExcelWorksheet.Columns("A:C").AutoFit
    Next
 
    'Print out All Sheets in this Excel Workbook
    For Each objSheet In objExcelWorkbook.Sheets
        objSheet.PrintOut
    Next
 
    objExcelWorkbook.Close False
    objExcelApp.Quit
End Sub

VBA Code - Print the Lists of Outlook Tasks with Different Categories in Different Pages

  1. Afterwards, press “F5” key button to run this macro right away.
  2. When the macro finishes, the lists of tasks with different categories will be printed in different pages, as shown in the following screenshot.Printed Task Lists

Get Back Valuable Data from Compromised PST File

If you’re subject to inaccessible PST file, your next step is undoubtedly PST repair. In this case, you can firstly try the inbox repair tool. Provided that it fails, you can proceed to try another external tool, such as DataNumen Outlook Repair. It’s able to recover PST data in quick time.

Author Introduction:

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

One response to “2 Ways to Print the Lists of Outlook Tasks with Different Categories in Different Pages”

Leave a Reply

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