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
|
Function EnvoiAttestation(fichier, personne, yr, Adresse)
Dim appOutLook As Object 'Outlook.Application
Dim MailOutLook As Object 'Outlook.MailItem
Dim myTxt As String
Dim NewLine: NewLine = "<br>"
myTxt = "Cher(e) membre," & NewLine & NewLine
myTxt = myTxt & "Veuillez trouver, en annexe, votre reçu de don pour l'année " & yr & "." & NewLine & NewLine
myTxt = myTxt & "Nous vous en souhaitons bonne réception, et vous remercions pour votre générosité ....blabla."
myTxt = myTxt & NewLine & NewLine & "Cordialement," & NewLine & NewLine
myTxt = myTxt & "L'association ....," & NewLine & NewLine & NewLine
myTxt = myTxt & "N.B.: Au cas où vous constatez une différence avec les montants réellement versés," & NewLine
myTxt = myTxt & vbTab & "merci de nous en faire part via la messagerie PRIVEE sur 'WhatsApp'."
If fichier <> "" Then
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
' .BodyFormat = olFormatRichText
.To = IIf(Adresse = "" Or IsNull(Adresse), "", Adresse)
'.cc = ""
'.bcc = ""
.Subject = "Reçu de Don - " & personne
.HTMLBody = myTxt
.Attachments.Add (fichier)
' .send
.display 'utilisé pour le test (désactiver si vous voulez envoyer et activer ".Send")
End With
Else
MsgBox "Le fichier " & strPath & strFilter & vbCrLf & _
"n'existe pas ! - Processus arrêté.", vbOKOnly, "Fichier inexistant"
Exit Function
End If
End Function |
Partager