mekcity33
Messages postés2Date d'inscriptionjeudi 11 mars 2010StatutMembreDernière intervention29 décembre 2010
-
29 déc. 2010 à 16:36
mekcity33
Messages postés2Date d'inscriptionjeudi 11 mars 2010StatutMembreDernière intervention29 décembre 2010
-
29 déc. 2010 à 23:52
Bonjour,
J'ai trouvé une macro VBA qui permet d'envoyer un mail Lotus. J'ai dernièrement appris que l'on pouvait faire des onglets dans le corps des mails (Tabbed Table). Je cherche donc à générer automatiquement ce genre de mail grâce au VBA. Est ce que quelqu'un a une idée de comment il faut faire? (J'ai déjà chercher sur internet et j'ai pas trouver grand chose)
voici le code que j'ai utilisé pour la macro:
Public Sub SendNotesMail(Subject As String, Attachment As String, Recipient As String, BodyText As String, SaveIt As Boolean)
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 Not MailDb.IsOpen Then MailDb.OPENMAIL
'Set up the new mail document
Set MailDoc = MailDb.CREATEDOCUMENT
MailDoc.form = "Memo"
MailDoc.sendto = Recipient
MailDoc.Subject = Subject
MailDoc.Body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachMe = MailDoc.CreateRichTextItem("Attachment")
Set EmbedObj = AttachMe.EMBEDOBJECT(1454, "", Attachment, "Attachment")
Call MailDoc.CreateRichTextItem(Attachment)
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