I'd be really grateful if some one could help me with this, I've been trying to work it out for a while but I'm not getting anywhere. I have a VBA to send an email based on individual rows and the data they contain.
I'd like a way of sending individual emails to all recipients and the data on their line if two conditions in their line are met - that Its been confirmed in column G and that no email has been sent; column H is empty. I'd like to do this with one button rather than creating a button for each line.
My VBA:
Sub SendEmailFromExcel()
Dim OutApp As Object, OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
if
.To = Range("E1").Value
.CC = Range("R1").Value
.Subject = Range("R1").Value
.Body = Range("J3") & vbNewLine & vbNewLine & _
Range("K2") & vbNewLine & _
Range("L2") & vbNewLine & _
Range("M2") & vbNewLine & _
Range("N2") & vbNewLine & _
Range("O2") & vbNewLine & vbNewLine & _
"Many Thanks,"
.Display
'.Send
End With
Set OutApp = Nothing
Set OutMail = Nothing
End Sub
I'd like a way of sending individual emails to all recipients and the data on their line if two conditions in their line are met - that Its been confirmed in column G and that no email has been sent; column H is empty. I'd like to do this with one button rather than creating a button for each line.
My VBA:
Sub SendEmailFromExcel()
Dim OutApp As Object, OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
if
.To = Range("E1").Value
.CC = Range("R1").Value
.Subject = Range("R1").Value
.Body = Range("J3") & vbNewLine & vbNewLine & _
Range("K2") & vbNewLine & _
Range("L2") & vbNewLine & _
Range("M2") & vbNewLine & _
Range("N2") & vbNewLine & _
Range("O2") & vbNewLine & vbNewLine & _
"Many Thanks,"
.Display
'.Send
End With
Set OutApp = Nothing
Set OutMail = Nothing
End Sub