1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Sub LireMessagesDUnDossierEtLeDeplacerVersUnAutre()
Dim olApp As Object, NS As Object, Dossier As Object
Dim i As Object, x As Long, R As Object, Ligne As Long
Dim notif As String, appareil As String
Dim Trouve As Range, PlageDeRecherche As Range
Dim Valeur_Cherchee As String, AdresseTrouvee As String
Set olApp = CreateObject("Outlook.Application")
Set NS = olApp.GetNamespace("MAPI")
Set DossierSource = NS.Folders(1).Folders("Boîte de réception").Folders("TEST")
For Each i In DossierSource.Items 'pour chaque mail dans le dossier source
notif = Left(i.Subject, 16)
notif = Right(notif, 9)
Set PlageDeRecherche = ActiveSheet.Columns(2)
Set Trouve = PlageDeRecherche.Cells.Find(what:=notif, LookAt:=xlWhole)
ActiveSheet.Cells(Trouve.Row, 1) = i.SenderName
appareil = Right(i.Subject, Len(i.Subject) - 25)
ActiveSheet.Cells(Trouve.Row, 3) = appareil
ActiveSheet.Cells(Trouve.Row, 4) = i.CreationTime
Next i
Set NS = Nothing
Set olApp = Nothing
Set PlageDeRecherche = Nothing
Set Trouve = Nothing
End Sub |
Partager