OLShowAppointmentsDuration

Outlook : Afficher la durée des RDV sélectionnées

Très pratique avec un affichage en liste :-)

Public Sub ShowAppointmentsDuration()
'================================================================================
' Show duration of selected appointments items
'
' Author    : Fabrice Vado
' Date      : 20080122
'================================================================================

On Error GoTo ShowAppointmentsDuration_Err

Dim myItem As Outlook.AppointmentItem
Dim iDuree As Integer

    iDuree = 0

    For Each myItem In ActiveExplorer.Selection
        iDuree = iDuree + DateDiff("n", myItem.Start, myItem.End)
   Next 

    MsgBox "Day" & vbTab & Format(iDuree / 60 / 7, "0.00") & vbCrLf & _
            "Hours" & vbTab & Format(iDuree / 60, "0.00") & vbCrLf & _
           " Minutes" & vbTab & Round(iDuree, 2), vbInformation

ShowAppointmentsDuration_Exit:
    Exit Sub
    
ShowAppointmentsDuration_Err:
    Select Case Err.Number
        Case 13
            Resume ShowAppointmentsDuration_Exit
       Case  Else
            MsgBox Err.Description & " (" & Err.Number & ")", vbExclamation
   End Selec t
End  Sub