Auto E-mail when cell displays "Yes"

Fourfly - Jan 25, 2018 at 08:26 AM
 Blocked Profile - Jan 25, 2018 at 04:58 PM
Good Day

Could someone please assist me with my query? I do not have many experience with VBA Macro, and would appreciate a simple answer.

I have a spreadsheet where column G contains text Yes or Blank cells. If Yes are displayed I would like an automatic e-mail to be sent to 1 e-mail address containing the info for that row.

Thank you in advance for your time.

1 response

Blocked Profile
Jan 25, 2018 at 04:58 PM
This cannot be done without considerable work, and preparation (CODING OF MAIL OBJECTS).

Here is some help, please do not ask me to modify it to suite your needs, that is YOUR job!

Dim OutlookApp As Object
Dim OutlookMail As Object

Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)

With OutlookMail
.to = VarToEmail
.CC = Var ccEmail
.BCC = bccemail
.Subject = varSubject
.Body = varBody
.Attachments.Add ActiveWorkbook.FullName
End With

Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub

I hope this is a good start, I have provided the HARD part.

Please understand, you will not be able to trigger this with a formula in a cell. It will need to be triggered with a button!