Hi,
I have VBA macro to send Email Envelope attached: It work fine if the worksheet is not protected.
But it doesn't work if I protect worksheet. Any Solution Please?
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 XXX and YYYY: Total xxxxxxxxx."
With .Item
.To = "fatosgaxha@gmail.com"
.CC = ""
.BCC = ""
.Subject = "Job: " & Sheet1.Range("C55") & " " & " Total xxxxxxxx"
'.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
I have VBA macro to send Email Envelope attached: It work fine if the worksheet is not protected.
But it doesn't work if I protect worksheet. Any Solution Please?
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 XXX and YYYY: Total xxxxxxxxx."
With .Item
.To = "fatosgaxha@gmail.com"
.CC = ""
.BCC = ""
.Subject = "Job: " & Sheet1.Range("C55") & " " & " Total xxxxxxxx"
'.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