I'm trying to using an If Statement with VBA but have never done it before.
IF C3="A" in the active excel workbook, send email to "Person A" & cc "Distribution List A". If not send email to "Person B" & cc "Distribution B".
Code shown below. Thanks for your help!!!!!!!
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "Person A"
.Cc = "Distribution List A"
'.BCC = ""
.Subject = "My Report"
.Body = "Report has been included as an attachment."
.Attachments.Add ActiveWorkbook.FullName
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Bookmarks