Bonjour,
Grace à l'aide sur ce forum de Daniel.C, j'ai une macro qui envoie un mail depuis un fichier excel en mettant ce meme fichier en PJ :
Pour un autre besoin, je cherche à ne plus mettre le tableau en pièce jointe mais dans le corps du mail par exemple la plage J1:L7.
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 Private Sub Command1_Click() Dim OutlookApp As New Outlook.Application Dim NewMail As Outlook.MailItem Set NewMail = OutlookApp.CreateItem(olMailItem) 'Liste des destinataires With NewMail .Recipients.Add (Sheets("Presentation").range("C45").Value) .Recipients.Add (Sheets("Presentation").range("C45").Value) .Recipients.Add (Sheets("Presentation").range("C45").Value) 'Sujet : .Subject = "sujet" 'Copies .CC = Sheets("Presentation").range("C45").Value & ";" & Sheets("Presentation").range("C45").Value & ";" & Sheets("Presentation").range("C45").Value & ";" & Sheets("Presentation").range("C45").Value 'Corps du mail : .Body = "Bonjour," & vbCrLf _ & vbCrLf _ & "hytzytzhhtzr" & Sheets("Presentation").range("F4").Value & vbCrLf _ & vbCrLf _ & "Cordialement" & vbCrLf _ & vbCrLf & vbCrLf _ & "pseudo" .Attachments.Add ActiveWorkbook.FullName .Display 'Envoi : .Send End With End Sub
J'ai essayé ce code mais il ne fonctionne pas :
Quelqu'un aurait-il une idée ?
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 Private Sub Command1_Click() Dim OutlookApp As New Outlook.Application Dim NewMail As Outlook.MailItem Set NewMail = OutlookApp.CreateItem(olMailItem) 'Liste des destinataires With NewMail .Recipients.Add (Sheets("Presentation").range("C45").Value) .Recipients.Add (Sheets("Presentation").range("C45").Value) .Recipients.Add (Sheets("Presentation").range("C45").Value) 'Sujet : .Subject = "sujet" 'Copies .CC = Sheets("Presentation").range("C45").Value & ";" & Sheets("Presentation").range("C45").Value & ";" & Sheets("Presentation").range("C45").Value & ";" & Sheets("Presentation").range("C45").Value 'Corps du mail : .Body = "Bonjour," & vbCrLf _ & vbCrLf _ & "qhrhthtahzthz " & Sheets("Presentation").range("F4").Value & vbCrLf _ & vbCrLf _ & ActiveSheet.range("A1:B5").Select & ActiveWorkbook.EnvelopeVisible = True & vbCrLf _ & "Cordialement" & vbCrLf _ & vbCrLf & vbCrLf _ & "pseudo" .Display 'Envoi : .Send End With End Sub
Merci à vous.
Partager