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
| Private Function Mail(Destinataire As String, Titre As String, Texte As String, Optional destinataire_principal As Variant) As Retour_mail
Dim ObjApp, ObjMail, ObjAttachement, colonne_date, ligne_date
Dim temp As Retour_mail
On Error GoTo Erreur
Set ObjApp = CreateObject("Outlook.Application")
Set ObjMail = ObjApp.CreateItem(olMailItem)
Set ObjAttachement = ObjMail.Attachments
If IsMissing(destinataire_principal) Then
ObjMail.To = Destinataire
Else
ObjMail.CC = Destinataire
ObjMail.To = destinataire_principal
End If
ObjMail.Subject = Titre
ObjMail.Body = Texte
ObjMail.Display
temp.utilisateur = ObjMail.session.currentuser.Name
temp.VraiFaux = True
GoTo fin
Erreur:
temp.VraiFaux = False
fin:
Mail = temp
End Function |
Partager