Kaillou, Forum AS400

Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
Kaillou, Forum AS400

Forum AS400 et de discussions

Le Deal du moment : -29%
PC portable – MEDION 15,6″ FHD Intel i7 ...
Voir le deal
499.99 €

    vba outlook:Sauvegarder automatiquement les mails

    Shewolf
    Shewolf
    Admin


    Nombre de messages : 190
    Localisation : 91 idf
    Emploi : Analyste Réalisateur / Chef de Projets

    vba outlook:Sauvegarder automatiquement les mails Empty vba outlook:Sauvegarder automatiquement les mails

    Message par Shewolf Mar 3 Juil - 17:12

    Astuce N° 1 , niveau amateur éclairé ^^
    Sauvegarder automatiquement les mails recus d'une personne dans un fichier texte avec le "mail_" + le sujet du message en nom de fichier texte :
    Dim OLapp As Outlook.Application
    Dim OLspace As Outlook.NameSpace
    Dim OLinbox As Outlook.MAPIFolder
    Dim OLfolder As Outlook.MAPIFolder
    Dim OLmail As Outlook.MailItem
    Dim OLpj As Outlook.Attachment
    Private Sub TransfertMailsDansFichierTexte()
    Dim OLbody As String
    Dim Cible As Integer
    Dim i As Byte
    Set OLapp = CreateObject("Outlook.application")
    Set OLspace = OLapp.GetNamespace("MAPI")
    Set OLinbox = OLspace.GetDefaultFolder(olFolderInbox)
    For Each OLmail In OLinbox.Items
    If OLmail.SenderName = "Person Roseline" Then
    OLbody = OLmail.Body
    i = i + 1
    Cible = FreeFile
    nom = OLmail.Subject
    'Adapter chemin fichier de suivi sur le reseau
    Open "C:\TST\mail_" & nom & ".txt" For Append As #Cible
    Print #1, OLbody
    Close #Cible
    End If
    Next
    Set OLapp = Nothing
    Set OLspace = Nothing
    Set OLinbox = Nothing
    End Sub
    Private Sub Application_NewMail()
    Call TransfertMailsDansFichierTexte
    End Sub

      La date/heure actuelle est Sam 11 Mai - 3:01

      Ne ratez plus aucun deal !
      Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
      IgnorerAutoriser