Bonjour tout le monde et merci d'avance pour l'assistance et le super aide que je trouve sur ce site
je cherche à envoyer par mail le classeur en cours via lotus note 8.5
j'ai trouvé ça sur le net, un code qui envoi un mail mais sans la pièce jointe (classeur en cours)
je travaille avec Excel 2010 et si j'utilise l'enregistreur auto (fichier / enregistrer et envoyer / envoyer à l'aide de messagerie / envoyer en tant que pièce jointe) le code est le suivant qui ouvre lotus note mais sans envoyer automatiquement le mail :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Sub Macro2() 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) '************** Application.Dialogs(xlDialogSendMail).Show Set Session = CreateObject("Notes.NotesSession") UserName = Session.UserName MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf" 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 = "bbbbb@ccc.fr" 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") 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
Merci à tous et bonne journée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 Sub Macro3() Application.Dialogs(xlDialogSendMail).Show End Sub
Partager