Private Sub Envoyer_Mail_Click()
Dim MaFeuille As Worksheet
Dim NbLigne As Integer
Application.ScreenUpdating = False
ActiveWorkbook.EnvelopeVisible = True
Set MaFeuille = ThisWorkbook.Sheets("Traitement")
NbLigne = MaFeuille.Range("N" & Application.Rows.Count).End(xlUp).Row
MaFeuille.Range("N1:T" & NbLigne).Select
With Selection.Parent.MailEnvelope.Item
.to = MaFeuille.Range("D6").Value
.Subject = MaFeuille.Range("F6").Value
.display
If MsgBox("Confirmez l'envoi", vbCritical + vbOKCancel) = vbOK Then
.Send
MsgBox "Votre mail a été envoyé." & vbLf & Err.Number & " " & Err.Description, _
vbInformation + vbOKOnly, "CONFIRMATION ENVOI MAIL"
End If
End With
ActiveWorkbook.EnvelopeVisible = False
Application.ScreenUpdating = True
End Sub