Hi all, I have a macro that will send an email automatically, but I can't get it to include the CC. I am guessing I have to "get" the value in Worksheets rather than just set it :/
Any help greatly appreciated.
Sub A2_Decline()
Set Authoriser1 = Worksheets("Process").Range("B5")
Set Authoriser2 = Worksheets("Process").Range("C5")
Set Authoriser3 = Worksheets("Process").Range("D5")
Set Authoriser4 = Worksheets("Process").Range("E5")
Dim OutApp As Object
Dim OutMail As Object
' Create a new Outlook instance
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0) ' 0 represents a mail item
' Compose the email
With OutMail
.To = Range("I12") & "@email.co.uk" ' Replace with the recipient's email address
.CC = Authoriser1 'Should be the email of the authoriser, this is set in the Process tab.
.Subject = "Approval Request " & Range("I4") & " : Declined" ' Replace with your email subject
.Body = "This has been declined. " & InputBox("This has been declined because...")
.Attachments.Add wb1.FullName
.Send
End With
' Clean up
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Any help greatly appreciated.
Sub A2_Decline()
Set Authoriser1 = Worksheets("Process").Range("B5")
Set Authoriser2 = Worksheets("Process").Range("C5")
Set Authoriser3 = Worksheets("Process").Range("D5")
Set Authoriser4 = Worksheets("Process").Range("E5")
Dim OutApp As Object
Dim OutMail As Object
' Create a new Outlook instance
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0) ' 0 represents a mail item
' Compose the email
With OutMail
.To = Range("I12") & "@email.co.uk" ' Replace with the recipient's email address
.CC = Authoriser1 'Should be the email of the authoriser, this is set in the Process tab.
.Subject = "Approval Request " & Range("I4") & " : Declined" ' Replace with your email subject
.Body = "This has been declined. " & InputBox("This has been declined because...")
.Attachments.Add wb1.FullName
.Send
End With
' Clean up
Set OutMail = Nothing
Set OutApp = Nothing
End Sub