Enoyer un mail sous Excel via Lotus Notes
MrNoch
-
f894009 Messages postés 17277 Date d'inscription Statut Membre Dernière intervention -
f894009 Messages postés 17277 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
J'ai trouvé ce code qui fonctionne sur le forum mais je voudrais que le mail s'affiche dans lotus avant d’être envoyé afin que l'utilisateur puisse ajouter ou modifié le contenu du mail, que dois-je modifier?
Merci d'avance.
code:
Sub SendNotesMail()
'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 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)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'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
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
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 = "la tu mets l'adresse mail de ton correspondant" '(laisse les "")
MailDoc.CopyTo = "l'adresse de la personne en copie" '(laisse les "")
MailDoc.Subject = "la tu mets le sujet" '(avec des "")
' Construction du corps du message
Set objNotesField = MailDoc.CreateRichTextItem("Body")
With objNotesField
.AppendText "Bonjour,"
.AddNewLine 2
.AppendText "Ci-joint la situation." 'tu peux réjouter des lignes
.AddNewLine 2
.AppendText "Cordialement"
.AddNewLine 1
.AppendText "Martin DUPONT"
.AddNewLine 3
End With
MailDoc.SaveMessageOnSend = SaveIt
'Set up the embedded object and attachment and attach it
Attachment1 = "la tu mets le chemin d'acces complet de ton fichier excel.xls"
Attachment2 = "idem 2e fichier"
Attachment3 = "idem 3e ficher"
If Attachment1 <> "" And Attachment2 <> "" And Attachment3 <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment1")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment1, "Attachment1")
MailDoc.CREATERICHTEXTITEM (Attachment1)
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment2")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment2, "Attachment2")
MailDoc.CREATERICHTEXTITEM (Attachment2)
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment3")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment3, "Attachment3")
MailDoc.CREATERICHTEXTITEM (Attachment3)
End If
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Recipient
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub
J'ai trouvé ce code qui fonctionne sur le forum mais je voudrais que le mail s'affiche dans lotus avant d’être envoyé afin que l'utilisateur puisse ajouter ou modifié le contenu du mail, que dois-je modifier?
Merci d'avance.
code:
Sub SendNotesMail()
'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 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)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'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
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
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 = "la tu mets l'adresse mail de ton correspondant" '(laisse les "")
MailDoc.CopyTo = "l'adresse de la personne en copie" '(laisse les "")
MailDoc.Subject = "la tu mets le sujet" '(avec des "")
' Construction du corps du message
Set objNotesField = MailDoc.CreateRichTextItem("Body")
With objNotesField
.AppendText "Bonjour,"
.AddNewLine 2
.AppendText "Ci-joint la situation." 'tu peux réjouter des lignes
.AddNewLine 2
.AppendText "Cordialement"
.AddNewLine 1
.AppendText "Martin DUPONT"
.AddNewLine 3
End With
MailDoc.SaveMessageOnSend = SaveIt
'Set up the embedded object and attachment and attach it
Attachment1 = "la tu mets le chemin d'acces complet de ton fichier excel.xls"
Attachment2 = "idem 2e fichier"
Attachment3 = "idem 3e ficher"
If Attachment1 <> "" And Attachment2 <> "" And Attachment3 <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment1")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment1, "Attachment1")
MailDoc.CREATERICHTEXTITEM (Attachment1)
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment2")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment2, "Attachment2")
MailDoc.CREATERICHTEXTITEM (Attachment2)
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment3")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment3, "Attachment3")
MailDoc.CREATERICHTEXTITEM (Attachment3)
End If
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Recipient
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub
Configuration: Windows / Firefox 91.0
A voir également:
- Enoyer un mail sous Excel via Lotus Notes
- Liste déroulante excel - Guide
- Word et excel gratuit - Guide
- Trier un tableau excel - Guide
- Déplacer colonne excel - Guide
- Si ou excel - Guide
3 réponses
Bonjour,
A priori, remplacez le .send par .display comme outlook
devient
Par contre n'ayant pas Lotus Notes, sait pas si le 0,etc doit etre avec
A priori, remplacez le .send par .display comme outlook
MailDoc.Send 0, Recipient
devient
MailDoc.Display 0, Recipient
Par contre n'ayant pas Lotus Notes, sait pas si le 0,etc doit etre avec