Dim appOutlook As Outlook.Application Dim nspOutlook As NameSpace Dim mpfMail As MAPIFolder Dim eMail As MailItem Dim ToutesPiecesJointes As Attachments Dim PieceJointe As Attachment Dim toto As String 'Affectation des variables objets Set appOutlook = ThisOutlookSession.Application Set nspOutlook = appOutlook.GetNamespace("MAPI") Set mpfMail = nspOutlook.GetDefaultFolder(olFolderInbox) For Each eMail In mpfMail.Items toto = eMail.Subject Set ToutesPiecesJointes = eMail.Attachments If Not TypeName(ToutesPiecesJointes) = "Nothing" Then For Each PieceJointe In ToutesPiecesJointes PieceJointe.SaveAsFile "D:\User" & PieceJointe.DisplayName Next PieceJointe End If Next eMail Set PieceJointe = Nothing Set ToutesPiecesJointes = Nothing Set olkMail = Nothing Set mpfMail = Nothing Set nspOutlook = Nothing Set appOutlook = Nothing
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question