In general, after you mark an Outlook task as completed, you may tend to check the next upcoming task subsequently. This article will tell you how to use Outlook VBA to let Outlook auto notify you of the next upcoming task.
More often than not, many users are accustomed to opening and viewing the next upcoming task after completing a task in that they have to begin to deal with the next task. As usual, if you would like to check the next upcoming task, you have to first sort all your task items by start date and then manually identify which is the next one. In this case, perhaps you may feel that it is a bit troublesome. Therefore, here we will guide you how to let Outlook automatically remind you of the next upcoming task after you marking one as completed. It will demand using Outlook VBA. The followings are the elaborate steps and codes.
Get a Notification of the Next Upcoming Task after Completing One
- For a start, you can launch your Outlook program.
- Then head to the “Developer” tab and click the “Visual Basic” button on this tab.
Note: If you can’t find this tab, you should turn to “File” > “Options” > “Customize Ribbon” to enable it firstly.
- Subsequently, in the opened VBA editor window, you should find and double click the “ThisOutlookSession” project on the left side.
- After that, copy and paste the following codes into this VBA project window.
Public WithEvents objTasks As Outlook.Items Private Sub Application_Startup() Set objTasks = Outlook.Application.Session.GetDefaultFolder(olFolderTasks).Items End Sub Private Sub objTasks_ItemChange(ByVal Item As Object) Dim objNotCompletedTasks As Outlook.Items Dim objNextUpcomingTask As TaskItem Dim strPrompt As String Dim nResponse As Integer 'Find out and Sort the non-completed tasks by start date If Item.Complete = True Then Set objNotCompletedTasks = objTasks.Restrict("[Complete] = False") objNotCompletedTasks.Sort "[StartDate]", descending Set objNextUpcomingTask = objNotCompletedTasks.Item(1) 'Prompt the next upcoming task strPrompt = "Your next upcoming task is " & objNextUpcomingTask.Subject & "." & vbCrLf & "Would you like to jump to and open it now?" nResponse = MsgBox(strPrompt, vbExclamation + vbYesNo, "Notify Next Task") 'Ask if to open the next upcoming task If nResponse = vbYes Then objNextUpcomingTask.Display End If End If End Sub
- Later you ought to sign this new macro.
- Next exit the VBA editor and restart Outlook to activate the macro,
- Finally you can have a try.
- At first, go to your default task folder.
- Then mark a task as completed.
- Next you will receive a notification of the next upcoming task.
- Lastly, if you select “Yes”, the next upcoming task will be opened at once.
Cannot be Immune from Corruption
As we all know, no software is flawless, of course including Outlook. Therefore, if you intend to use Outlook for decades, you have to accept the truth that various issues can occur to your Outlook in the future. Hence, it is prudent and suggested to keep an Outlook fix tool nearby, such as DataNumen Outlook Repair. It will come in handy if your Outlook gets corrupted.
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