Code as below:
Sub SendEmail()
Dim SendingRng As Range
On Error GoTo StopMacro
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set SendingRng = Worksheets("Subtotal RTO").Range("C1:D5")
With SendingRng
.Parent.Select
.Select
' Create the mail and send it
ActiveWorkbook.EnvelopeVisible = True
With .Parent.MailEnvelope
.Introduction = "Hi xxxx and yyyyyyy: Total XXXXX 's has exceed ."
With .Item
.To = "xxxxxxxx.com"
.CC = ""
.BCC = ""
.Subject = "Job: " & Sheet2.Range("C2") & " " & " Total "
'.Attachments.Add (ThisWorkbook.FullName)
.Importance = 2
.Send
End With
End With
End With
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False
End Sub
Sub SendEmail()
Dim SendingRng As Range
On Error GoTo StopMacro
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set SendingRng = Worksheets("Subtotal RTO").Range("C1:D5")
With SendingRng
.Parent.Select
.Select
' Create the mail and send it
ActiveWorkbook.EnvelopeVisible = True
With .Parent.MailEnvelope
.Introduction = "Hi xxxx and yyyyyyy: Total XXXXX 's has exceed ."
With .Item
.To = "xxxxxxxx.com"
.CC = ""
.BCC = ""
.Subject = "Job: " & Sheet2.Range("C2") & " " & " Total "
'.Attachments.Add (ThisWorkbook.FullName)
.Importance = 2
.Send
End With
End With
End With
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False
End Sub