Salut Arnaud87,
Pourquoi dans la rangée C3 faire un une liste X1/X2/X3 alors que tu pourrais faire directement la liste avec les adresses email des destinataires ?
Cela te donnerai ensuite par exemple :
Public Destinataire As String
Sub test()
If Worksheets("Feuil1").Range("L3") <> "" Then
Destinataire = Worksheets("Feuil1").Range("C3").Value
Call EnvoiMail
End If
End Sub
et
Sub EnvoiMail()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<font size=""3"" face=""Calibri"">" & _
"Bonjour,<br><br>" & _
"L'étude<B> " & Cells(LigneInfos, 1).Value & " </B>peut être controlé, je l'ai mise en correction sur le serveur." & _
"<br>Commentaires:<B> " & Cells(LigneInfos, 8).Value & "</B>." & _
"<br><br>Cordialement" & _
"<br><br>" & Cells(LigneInfos, 3).Value & "</font>"
On Error Resume Next
With OutMail
.To = Destinataire
.CC = "X11@fy.fr"
.BCC = ""
.Subject = "Contrôle Etude " & Cells(LigneInfos, 1).Value & ""
.HTMLBody = strbody
.Display
'.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Qu'en penses-tu ?
Cordialement,
Baboutz