Public Sub ExportePiecesJointes(DossierOLChoisi As String, RépertoireDest As String, MarqueLu As StatutLecture)
Dim I As Long
Dim OK As Boolean
Dim Ol As New Outlook.Application
Dim Ns As Outlook.Namespace
Dim DOSSIER As Outlook.MAPIFolder
Set Ns = Ol.GetNamespace("MAPI")
For I = 1 To Ns.Folders.Count
Set DOSSIER = Ns.Folders(I) ' détermine le premier compte
If DOSSIER.Name = CompteMail Then
OK = True
Exit For
End If
Next
If Not OK Then
Set DOSSIER = Ns.Folders.Item(1)
End If
SearchFolders DOSSIER, DossierOLChoisi, RépertoireDest, MarqueLu
X = 0
End Sub