How to Quickly Assign an Outlook Task to All Email Addresses in an Excel File

If you would like to assign an Outlook task to all the email addresses in an Excel file, you can refer to this article. Here we will expose a smart way, which can help you accomplish it just via a click.

Assuming that you have an Excel file which contains the team members who are responsible for a project, and at present you hope to assign an Outlook task to all of them, you can use the piece of VBA code shown in the followings.

Quickly Assign an Outlook Task to All Email Addresses in an Excel File

Assign a Task to All Email Addresses in an Excel File

  1. Here we will take the following Excel file as an example.Sample Excel File
  2. At the very outset, you should start your Outlook program.
  3. Then, in the main Outlook window, switch to “Developer” tab and click on the “Visual Basic” button.
  4. Next, a new window will display, in which you should enable “Microsoft Excel Object Library”. You can tap on the “Tools” button and choose “Reference”. In the newly popup dialog box, find the object library, check it and hit “OK”.
  5. Subsequently, copy and paste the following VBA code into an unused module.
Sub AssignTasktoAllEmailAddressesInExcel()
    Dim strExcelFile As String
    Dim objExcelApp As Excel.Application
    Dim objExcelWorkBook As Excel.Workbook
    Dim objExcelWorkSheet As Excel.Worksheet
    Dim nRow As Integer
    Dim nColumn As Integer
    Dim objTask As Outlook.TaskItem
    'Change the path to the source Excel file
    strExcelFile = "E:\Team Members.xlsx"
    On Error Resume Next
    Set objExcelApp = CreateObject("Excel.Application")
    Set objExcelWorkBook = objExcelApp.Workbooks.Open(strExcelFile)
    Set objExcelWorkSheet = objExcelWorkBook.Sheets("Sheet1")
    'Create a new Task
    Set objTask = Outlook.Application.CreateItem(olTaskItem)
    With objTask
         .Subject = "Test Task 2"
         .StartDate = #9/11/2017#
         .DueDate = #9/18/2017#
          .Body = "This is a test task"
    End With
    '!!!Change the row and column as per your own Excel file
    nRow = 2
    nColumn = 4
    'Add the email addresses as the Task recipients
    While objExcelWorkSheet.Cells(nRow, 4) <> ""
          objTask.Recipients.Add (objExcelWorkSheet.Cells(nRow, 4))
          nRow = nRow + 1
    'Send this Task
    With objTask
    End With
    objExcelWorkBook.Close False
End Sub

VBA Code - Assign a Task to All Email Addresses in an Excel File

  1. After that, you can try this macro. Just trigger it by clicking the “Run” icon in the toolbar or taping on the “F5” key button.
  2. At once, the macro will start. Lastly, after it finishes, you will see that a Task is sent out, located in your “Sent Items” folder, like the screenshot below:Assigned Task Request

Never Fear Outlook Corruption

Due to Outlook’s vulnerability, many users always keep panic when coping with the stack of emails in Outlook. However, actually, as long as you make sufficient precautions, you will not need to fear Outlook damage. For example, you ought to back up your PST data file on a regular basis. Also, you have to learn how to find and run the internal repair tool – Scanpst.exe. Besides, it is also advisable to hold a credible external PST fix utility, such as DataNumen Outlook Repair.

Author Introduction:

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

Comments are closed.