How to Auto Print the Task List of the Whole Week Every Monday in Your Outlook

Perhaps you always need to print out the task list of the whole week every Monday. This article will expose you a piece of VBA code, which can let Outlook to auto do it.

If you prefer to view your tasks on paper instead of in the computer screen, you may need to always print out the tasks. For instance, you may be accustomed to printing out the task list of the whole week every Monday. In this scenario, you can make use of the method in the followings, which will enable Outlook to auto realize it.

Auto Print the Task List of the Whole Week Every Monday in Your Outlook

Auto Print the Task List of the Whole Week Every Monday

  1. At the very outset, start your Outlook application.
  2. After entering the main Outlook window, press “Alt + F11” key buttons.
  3. Then you will get into Outlook VBA editor window.
  4. Now you ought to double click on the “ThisOutlookSession” project in the left side of the current window.
  5. In the opened “ThisOutlookSession” project window, paste the following VBA code into it.
Dim strExcelFile As String
Dim objExcelApp As Excel.Application
Dim objExcelWorkbook As Excel.Workbook
Dim objExcelWorksheet As Excel.Worksheet

Private Sub Application_Reminder(ByVal Item As Object)
    If Item.Class = olTask And Item.Subject = "Print Tasks" Then
       Call PrintTaskList
    End If
End Sub

Sub PrintTaskList()
    Dim objStores As Outlook.Stores
    Dim objStore As Outlook.Store
    Dim objPSTFile As Outlook.Folder
    Dim objFolders As Outlook.folders
    Dim objFolder As Object
    Dim objShell As Object
    Dim objTempFolder As Object
    Dim objTempFolderItem As Object
    'Create a new Excel file
    Set objExcelApp = CreateObject("Excel.Application")
    Set objExcelWorkbook = objExcelApp.Workbooks.Add
    Set objExcelWorksheet = objExcelWorkbook.Sheets("Sheet1")
    objExcelWorksheet.Cells(1, 1) = "Subject"
    objExcelWorksheet.Cells(1, 2) = "Start Date"
    objExcelWorksheet.Cells(1, 3) = "Due Date"
    Set objStores = Outlook.Application.Session.Stores
    'Process all Outlook PST files in your Outlook
    For Each objStore In objStores
        Set objPSTFile = objStore.GetRootFolder
        For Each objFolder In objPSTFile.folders
            Call ProcessFolders(objFolder)
    'Fit the columns from A to B
    'Save the Excel file in a temp folder
    strTempFolder = "E:\Temp " & Format(Now, "yyyy-mm-dd hh-mm-ss")
    MkDir (strTempFolder)
    strExcelFile = strTempFolder & "\This Week Tasks (" & Format(Now, "yyyy-mm-dd hh-mm-ss") & ").xlsx"
    objExcelWorkbook.Close True, strExcelFile
    'Print the Excel file
    Set objShell = CreateObject("Shell.Application")
    Set objTempFolder = objShell.NameSpace(0)
    Set objTempFolderItem = objTempFolder.ParseName(strExcelFile)
    objTempFolderItem.InvokeVerbEx ("print")

    MsgBox "Complete!", vbExclamation
End Sub

Sub ProcessFolders(ByVal objCurrentFolder As Outlook.Folder)
    Dim strLastDate As Date
    Dim strFilter As String
    Dim objTasks As Outlook.Items
    Dim objRestrictTasks As Outlook.Items
    Dim i As Long
    Dim objTask As Object
    Dim nLastRow As Integer
    Dim objSubfolder As Outlook.Folder
    dLastDate = Format(Date + 6, "YYYY-MM-DD")
    If objCurrentFolder.DefaultItemType = olTaskItem Then
       'Get the tasks of this week
       Set objTasks = objCurrentFolder.Items
       strFilter = "[DueDate] <= """ & dLastDate & """"
       Set objRestrictTasks = objTasks.Restrict(strFilter)
       'Fill the information of the tasks of this week in the excel cell
       For i = objRestrictTasks.Count To 1 Step -1
           Set objTask = objRestrictTasks.Item(i)
           If objTask.Complete = False And objTask.Subject <> "Print Tasks" Then
              nLastRow = objExcelWorksheet.Range("A" & objExcelWorksheet.Rows.Count).End(xlUp).Row + 1
              objExcelWorksheet.Range("A" & nLastRow) = objTask.Subject
              objExcelWorksheet.Range("B" & nLastRow) = objTask.StartDate
              objExcelWorksheet.Range("C" & nLastRow) = objTask.DueDate
           End If
    End If
    If objCurrentFolder.folders.Count > 0 Then
       For Each objSubfolder In objCurrentFolder.folders
           Call ProcessFolders(objSubfolder)
    End If
End Sub

VBA Code - Auto Print the Task List of the Whole Week Every Monday

  1. Subsequently, sign this code.
  2. Later change your Outlook macro settings to permit signed macros.
  3. After that, you ought to create a recurring task by following the steps below:
  • Firstly, create a new task.
  • In the new Task window, input the subject “Print Tasks”.
  • Then click on “Recurrence” button in the ribbon.
  • Next enable a “Weekly – Monday – No end date” recurrence.Create a Recurring Task
  • After that, enable a reminder for printing this task.
  • Lastly, save and close the current new recurring task.
  1. From now on, every Monday when the reminder alerts you, Outlook will auto print the task list of the current whole week. Also, you can check the source Excel file in the newly created temp folder as well.Task List

Deal with Outlook Issues

In some degrees, it is inevitable for you to encounter various issues during using Outlook. Thus, you are better off mastering some effective ways for coping with Outlook issues. For example, it’s suggested to get hold of a PST fix tool, which can save you from painful permanent PST data loss.

Author Introduction:

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

Comments are closed.