Bonsoir
Je souhaite envoyer un mail à plusieurs destinataires.
Les adresses mails des destintaires se trouvent dans la colonne t et commence en t3.
Le nom du fichier a joindre se trouve dans le colonne U.
Voici le code que j'ai rédigé mais il ne fonctionne pas. La variable i a été signalé incompatible.
Merci de m'aider avec excuse sur le code coller en brut (option indisponible sur mon smartphone.
Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 ' This example sends the last saved version of the Activeworkbook object . Dim OutApp As Object Dim OutMail As Object Dim texte As String Dim Nomfic As String, spath As String Dim fp As Worksheet Dim i As String 'Set ft = Sheets("MAQUET_OBJECTIFS") Set fp = Sheets("PARAMETRE") spath = "C:\Users\" & Environ("username") & "\Documents\OBJECTIFS 2018\" & "DETAIL REPARTITION OBJECTIFS 2018\" Nomfic = fp.Range("T" & i).Offset(0, 1) For i = 3 To fp.Range("T" & Rows.Count).End(xlUp).Row Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) texte = texte & "Bonsoir" texte = texte & "Merci de trouver en fichier joint vos objectifs de l'année 2018" & vbCrLf texte = texte & "Les originaux vous parviendront dans nos meilleurs délais." & vbCrLf & vbCrLf texte = texte & "Bonne réception." & vbCrLf & vbCrLf On Error Resume Next With OutMail 'For l = 3 To fp.Range("B" & Rows.Count).End(xlUp).Row .To = fp.Range("T" & i) .Cc = "ydabire@boaburkinafaso.com,wkabore@boaburkinafaso.com" .BCC = "" .Subject = "OBJECTIFS 2018" .Body = texte .Attachments.Add spath & Nomfic & ".PDF" .Send Next i 'Next l End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing
Partager