Dim olApp As Outlook.Application, olNs As Object, Fldr As Object, olMail As object
'création de l'object Outlook
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Select Case UCase(Environ("username"))
Case "LeChef"
Set Fldr = olNs.GetDefaultFolder(6).Folders("Collègues") 'le dossier Collègues
Case Else
Set Fldr = olNs.GetDefaultFolder(6) 'la boite de reception par defaut
End Select
For Each olMail In Fldr.Items
If olMail.Subject = "Objet à traiter" Then
MaVariableHeureMail = Format(olMail.ReceivedTime, "hh:mm:ss")
End If
Next olMail