IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Contribuez Discussion :

Envoyer de mail avec Lotus


Sujet :

Contribuez

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Avril 2014
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2014
    Messages : 21
    Points : 7
    Points
    7
    Par défaut Envoyer de mail avec Lotus
    Bonjour à tous,

    J'ai le code ci-dessous pour envoyer automatiquement des mails à des individus situés dans la colonne ES si dans la colonne FK , on a une condition remplie par exemple mail_ok . Seulement quand j'exécute la macro rien ne se passe. Quelqu'un pourrait me dépanner?


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    Sub mail1lotus()
    '''''''''''' création copy
         ''''''''''''''''''''''''''''''''''''''''''''''
       Workbooks("Envoi Mail par Lotus.xlsx").Activate
     
     
       Sheets("feuil1").Copy
       Sheets("feuil1").Select
     
    ChDir "D:\Users\ggnamey\Documents\affaire_os\affaire\courrier"
     
     
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "D:\Users\ggnamey\Documents\affaire_os\affaire\courrier\courrier1" & ".pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
     
            ActiveWorkbook.Close False
            Range("A1").Select
     
     
     
        date2 = Workbooks("Projet_GRDF_TEST").Sheets("Accueil").Range("C3").Value
        donnees2 = "recap_affaire" & date2 & ".xls"
        num_semaine2 = Workbooks(donnees2).Sheets(1).Name
     
    'envoie un mail si condition remplie
     
        Workbooks(donnees2).Activate ' nom de fichier a remplir
        Sheets(num_semaine2).Range("a1").Select
     
     
     
        Dim Sujet As String, Corps As String
        Dim CC As String, c As Range, PJ As String
        Sujet = "Sujet du message"
        Corps = "Corps du message"
        CC = ""
        ' Desti = "****@*****.***"
        PJ = Nom_Fichier1
        SendNotesMail Sujet, Corps, Desti, CC, PJ
        Nom_Fichier = "D:\Users\ggnamey\Documents\affaire_os\affaire\courrier\courrier1.pdf"
     
    End Sub
     
    Public Sub SendNotesMail(Sujet, Corps, Desti, CC, PJ)
    'Set up the objects required for Automation into lotus notes
        Dim Maildb As Object 'The mail database
        Dim UserName As String 'The current users notes name
        Dim Corps_Msg As String ' text du courriel
        Dim MailDbName As String 'THe current users notes mail database name
        Dim MailDoc As Object 'The mail document itself
        Dim AttachME As Object 'The attachment richtextfile object
        Dim Session As Object 'The notes session
        Dim EmbedObj As Object 'The embedded object (Attachment)
        Dim cell As Range
        Dim tableauDestinataires() As String
        Dim nbDestinataires As Integer
        Dim Nom_Fichier As String
        nbDestinataires = 0
        Desti = tableauDestinataires
        Application.ScreenUpdating = False
     
         For Each cell In Columns("ES").Cells.SpecialCells(xlCellTypeConstants)
            If cell.Value Like "?*@?*.?*" And _
               LCase(Cells(cell.Row, "FK").Value) <> "" Then
                   ReDim Preserve tableauDestinataires(nbDestinataires)
                   tableauDestinataires(nbDestinataires) = cell.Value
                   nbDestinataires = nbDestinataires + 1
            End If
        Next cell
     
     
        'Start a session to notes
        Set Session = CreateObject("Notes.NotesSession")
        'Next line only works with 5.x and above. Replace password with your Password
        ' Session.Initialize ("Password")
        'Get the sessions username and then calculate the mail file name
        'You may or may not need this as for MailDBname with some systems you
        'can pass an empty string or using above password you can use othermailboxes.
        ''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) -InStr(1, UserName, " "))) & ".nsf"
        ''UserName = Session.UserName
     
        ''SearchString = Recipient
        ''SearchChar = "@"
        ''MyPos = InStr(1, SearchString, SearchChar, vbTextCompare)
        ''Destinataire = Left(SearchString, MyPos - 1)
        'Open the mail database in notes
        Set Maildb = Session.GetDataBase("", "")
         If Maildb.IsOpen = True Then
             'Already open for mail
         Else
             Maildb.OpenMail
         End If
        'Set up the new mail document
        Set MailDoc = Maildb.CreateDocument
        MailDoc.Form = "Memo"
        MailDoc.Sendto = Desti
        MailDoc.Subject = Sujet
        MailDoc.copyto = CC
        'MailDoc.Body = Corps
        Set MailCorps = MailDoc.CreateRichTextItem("Body")
     
        With MailCorps
        .ADDNEWLINE 1
        .APPENDTEXT Corps
        .ADDNEWLINE 2
        End With
     
        MailDoc.SaveMessageOnSend = True
        'Set up the embedded object and attachment and attach it
        Set AttachME = MailDoc.CreateRichTextItem("Attachment")
        'AttachME.AppendText "toto"
        Call AttachME.EmbedObject(1454, "", PJ, "Attachment")
     
        'Send the document
        MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
        MailDoc.Send 0
        Clean Up
        Set Maildb = Nothing
        Set MailDoc = Nothing
        Set AttachME = Nothing
        Set Session = Nothing
        Set EmbedObj = Nothing
     
        Application.ScreenUpdating = True
     
    End Sub

  2. #2
    Expert éminent sénior
    Avatar de Marc-L
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2013
    Messages
    9 468
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 9 468
    Points : 18 677
    Points
    18 677
    Par défaut

    Non car encore une fois, à consulter & à respecter

    A quoi sert un forum Contribuez (ou de contributions) comme pourtant détaillé dans le lien ?!

    Ce n'est pourtant pas ta première discussion …
    C'est parce que la vitesse de la lumière est plus rapide que celle du son que tant de gens paressent brillants avant d'avoir l'air con ! (Thomas Boishardy)

Discussions similaires

  1. [AC-2003] Envoyer mail avec Lotus Notes 6.5 à partir d'Access
    Par demichoux dans le forum VBA Access
    Réponses: 8
    Dernier message: 04/03/2019, 17h10
  2. Envoyer e-mail avec Pj via messagerie client lotus notes
    Par Debutant10 dans le forum VBScript
    Réponses: 3
    Dernier message: 25/05/2013, 16h27
  3. envoyer un mail avec mon programme
    Par shrek dans le forum C++Builder
    Réponses: 8
    Dernier message: 06/12/2006, 13h27
  4. Comment envoyer un mail avec la commande mail
    Par pi3141563 dans le forum Réseau
    Réponses: 5
    Dernier message: 21/10/2004, 14h34
  5. Envoyer un mail avec mailto de haute importance
    Par VirginieGE dans le forum ASP
    Réponses: 3
    Dernier message: 13/08/2004, 14h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo