Management of small chains of tasks in Outlook

This Excel Macro can help you manage multiple-step projects using Outlook tasks.

MS Outlook does not allow to manage multiple-step projects. To use this macro you just need to create a new task in Outlook giving it a name of the project and inserting the step-by-step plan in the text of the task. 



Now you can click "Save and Close" and everything is set up.

After you completed the step 1 (bought your tickets for the trip) select the task in the task list and run the macro. As a result you will see the following:

The first task will contain the text of Step 1 and will automatically be marked "Complete". The second task will have Step 2 as the first item.

Download the module - Task-Slicer.bas

Firstly we need a new name for the next step of the project. This function finds the hashtag #Step and assigns the next number when a step has been completed:

Private Function NewSubject(InSubject As String, nextstep As Boolean) As String

Dim i As Long
Dim LastHTag, StepNumber As Integer
Dim FirstStep As Boolean

    LastHTag = 0
    FirstStep = True
    StepNumber = 1
    LastHTag = 1
NewSubject = InSubject

For i = 1 To Len(NewSubject)
    If Left(Right(NewSubject, Len(NewSubject) - i), 1) = "#" Then LastHTag = i + 1
Next i

If Mid(NewSubject, LastHTag + 1, 4) = "Step" Then FirstStep = False

Select Case FirstStep
Case True

    LastHTag = InStr(LastHTag, NewSubject, Chr(32))
    NewSubject = Left(NewSubject, LastHTag) & "#Step" & StepNumber & " " & Right(NewSubject, Len(NewSubject) - LastHTag)
Case False

    StepNumber = Int(Mid(NewSubject, LastHTag + 5, InStr(LastHTag, NewSubject, Chr(32)) - 5 - LastHTag))
    If nextstep = True Then StepNumber = StepNumber + 1
    NewSubject = Left(NewSubject, LastHTag + 4) & StepNumber & Right(NewSubject, Len(NewSubject) + 1 - InStr(LastHTag, NewSubject, Chr(32)))

End Select

End Function

The code of the main function:

Sub SelectedTask_NextStep()

Dim OlApp As Application
Dim objItem, NewTask As TaskItem

Dim TaskText As String
Dim Delimiter As Long

Set OlApp = Application

'//get selected/open task
'case - task not open
Set objItem = OlApp.ActiveExplorer.Selection.Item(1)
'case - task open
'Set objItem = objApp.ActiveInspector.CurrentItem

TaskText = objItem.Body
Delimiter = InStr(TaskText, Chr(10))
objItem.Body = Left(TaskText, Delimiter)
objItem.Subject = NewSubject(objItem.Subject, False)
objItem.Status = 2

Set NewTask = OlApp.CreateItem(olTaskItem)
    With NewTask

        .Subject = NewSubject(objItem.Subject, True)
        .DueDate = objItem.DueDate
        .Status = 1                 '0=not started, 1=in progress, 2=complete, 3=waiting,
        .Importance = 1             '0=low, 1=normal, 2=high
        .ReminderSet = False
        '.ReminderTime = dtReminderDate
        .Categories = objItem.Categories 'use any of the predefined Categorys or create your own
        .Body = Right(TaskText, Len(TaskText) - Delimiter)
        .Save   'use .Display if you wish the user to see the task form and make
                'them perform the save
    End With
End Sub

For convenience it is good to assign the macro to a custom button on the ribbon.

Button on the ribbon - Project next step - MS Outlook


Support the project

Please feel free to support me on Patreon.