Sub AfficherTempsTotaux()
Dim l_l_i As Long
Dim l_l_nbTasks As Long
Dim l_o_selection As Selection
Dim l_o_task As TaskItem
Dim l_l_totalWork As Long
Dim l_l_actualWork As Long
Dim l_s_text As String
Set l_o_selection = Application.ActiveExplorer.Selection
For l_l_i = 1 To l_o_selection.Count
If TypeOf l_o_selection.Item(l_l_i) Is TaskItem Then
l_l_nbTasks = l_l_nbTasks + 1
Set l_o_task = l_o_selection.Item(l_l_i)
l_l_totalWork = l_l_totalWork + l_o_task.TotalWork
l_l_actualWork = l_l_actualWork + l_o_task.ActualWork
End If
Next l_l_i
Set l_o_task = Session.GetDefaultFolder(olFolderTasks).Items(1)
If l_l_nbTasks = 0 Then
MsgBox "Aucune tâche n'est sélectionnée."
Else
l_s_text = l_l_nbTasks & " tâche(s) sélectionnée(s) :"
l_s_text = l_s_text & vbNewLine & " - Temps total : " & VBA.Format(l_l_totalWork / 60 / 24, "hh:mm")
l_s_text = l_s_text & vbNewLine & " - Temps réel : " & VBA.Format(l_l_actualWork / 60 / 24, "hh:mm")
MsgBox l_s_text
End If
Set l_o_selection = Nothing
Set l_o_task = Nothing
End Sub