Biglou1221
New Member
So, even though I'm VERY limited on coding knowledge, thanks to user chirayu my auto email is up and running. I reworked parts of it for another project, but have reached another stopping point. What I'm attempting is to use is an If statement to determine the recipient of an auto-email. Is this possible? What I've got looks like:
All it's entering for .to though is "user1@mail.com". Which leads me to believe it sees the initial .to = "user1@mail.mil" and quits running through conditions. These emails won't change, so I thought it would be easier just to include them in the code. Every other line is working perfectly and it IS creating emails, just not based on the above conditions. I appreciate any help you can provide.
Code:
On Error Resume Next
With OutApp.CreateItem(0)
If Range("A", ActiveCell.Row).Value = "1" Then
.to = "user1@mail.com"
ElseIf Range("A", ActiveCell.Row).Value = "2" Then
.to = "user2@mail.com"
Else
.to = "user3@mail.com"
End If
.CC = "Who I. Am@mail.com"
.BCC = ""
.Subject = "Currency Almost out of Date" 'change this to whatever you want
.Body = MyText
.Display 'or use .Send to send the email automatically
End With
On Error GoTo 0
All it's entering for .to though is "user1@mail.com". Which leads me to believe it sees the initial .to = "user1@mail.mil" and quits running through conditions. These emails won't change, so I thought it would be easier just to include them in the code. Every other line is working perfectly and it IS creating emails, just not based on the above conditions. I appreciate any help you can provide.