Bonsoir
je cherche depuis quelques jours une solution pour envoyer un mail selon la couleur de la cellule
j ai un message quand la macro démarre sur send si quelqu un peut me débloquer je joint le fichier
Encore merci
Option Explicit
Sub Conditions()
Dim Message As String
With Sheets("Feuil1").Range("J9:J97").Activate
If ActiveCell.Interior.ColorIndex = 1 Then EnvoiMail Message
End With
End Sub
Sub EnvoiMail(Message As String)
Dim OutApp As Object, OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Sheets("Feuil1").Range("K3").Value
.Send '<<<<<<<<<<<< Pour envoyer directement
End With
Set OutApp = Nothing: Set OutMail = Nothing
On Error GoTo 0: Err.Clear
Exit Sub
Set OutApp = Nothing: Set OutMail = Nothing
On Error GoTo 0: Err.Clear
Exit Sub
End Sub
je cherche depuis quelques jours une solution pour envoyer un mail selon la couleur de la cellule
j ai un message quand la macro démarre sur send si quelqu un peut me débloquer je joint le fichier
Encore merci
Option Explicit
Sub Conditions()
Dim Message As String
With Sheets("Feuil1").Range("J9:J97").Activate
If ActiveCell.Interior.ColorIndex = 1 Then EnvoiMail Message
End With
End Sub
Sub EnvoiMail(Message As String)
Dim OutApp As Object, OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Sheets("Feuil1").Range("K3").Value
.Send '<<<<<<<<<<<< Pour envoyer directement
End With
Set OutApp = Nothing: Set OutMail = Nothing
On Error GoTo 0: Err.Clear
Exit Sub
Set OutApp = Nothing: Set OutMail = Nothing
On Error GoTo 0: Err.Clear
Exit Sub
End Sub
Dernière édition: