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
| Sub UseLotus()
Dim Session As Object
Dim Dir As Object
Dim Doc As Object
Dim Workspace As Object
Dim EditDoc As Object
On Error GoTo TraiteErreur
'Création de la session Notes
Set Workspace = CreateObject("Notes.NotesUIWorkspace")
Set Session = CreateObject("notes.NOTESSESSION")
Set Dir = Session.GETDATABASE("", "")
Call Dir.OPENMAIL
'Constitution du message
'
Set Doc = Dir.CREATEDOCUMENT
Doc.Form = "memo"
Doc.Sendto = "ton destinataire"
Doc.Subject = "ton titre d'objet mail"
'body
Message = "coucou"
Set objNotesField = Doc.CREATERICHTEXTITEM("Body")
With objNotesField
.AppendText Message ' tu doit déclarer MESSAGE ex : MESSAGE = range("c19").value
End With
Doc.SaveMessageOnSend = SaveIt
Doc.PostedDate = Now()
Doc.Send 0, Recipient
'Affichage du mail dans Lotus Notes
Set EditDoc = Workspace.EditDocument(True, Doc)
Set Session = Nothing
Set Dir = Nothing
Set Doc = Nothing
Set Workspace = Nothing
Set EditDoc = Nothing
Exit Sub
TraiteErreur:
MsgBox "Problème de création du mail", vbCritical, "Error"
Set Session = Nothing
Set Dir = Nothing
Set Doc = Nothing
Set Workspace = Nothing
Set EditDoc = Nothing
End Sub |
Partager