J
Jenny B.
Hi Ron,
I'm a big fan of your CDO procedure that sends emails from Excel avoiding
the security warnings – great idea. I'm currently using one of your send
programs and I'm wondering if you could help me to add on last step.
After reviewing your other email macros with added text body, I can’t quite
find one that exactly covers the one piece I need to add. I just need one
additional line of code to attach a copy of the “Account Mgmt Checklist†to
the second group in the program (noted in the routine). These recipients are
already pre-determined by front side by programming. The second part of the
code looks for "Sales" as the determinant for those recipients who would
receive the attachment. The “Sales†group would receive a spreadsheet and
message vs. the “Yes†group just getting the message.
Any thoughts would be greatly appreciated.
Thanks so much and I really think this CDO process is slick - Jenny B.
Option Explicit
Sub CDO_Personalized_Mail_Body()
Dim iMsg As Object
Dim iConf As Object
Dim cell As Range
Dim Flds As Variant
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set iConf = CreateObject("CDO.Configuration")
For Each cell In
Sheets("Sheet1").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Offset(0, 1).Value <> "" Then
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value)
= "yes" Then
Set iMsg = CreateObject("CDO.Message")
With iMsg
Set .Configuration = iConf
.To = cell.Value
.From = """Account Mgmt"" <[email protected]>"
.Subject = "New Book Entry Checklist" & " - " &
Sheets("Account Mgmt Checklist").Range("F5").Value
.TextBody = "Hello " & cell.Offset(0, -1).Value &
vbNewLine & vbNewLine & _
"Please review the Book Entry Checklist and
forward to the DMS Group when complete." _
& vbNewLine & vbNewLine & "Thank you - Account Management"
.Send
End With
Set iMsg = Nothing
End If
End If
If cell.Offset(0, 1).Value <> "" Then
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value)
= "sales" Then
Set iMsg = CreateObject("CDO.Message")
With iMsg
Set .Configuration = iConf
.To = cell.Value
.From = """Account Mgmt"" <[email protected]>"
.Subject = "New Book Entry Checklist" & " - " &
Sheets("Account Mgmt Checklist").Range("F5").Value
.TextBody = "Hello " & cell.Offset(0, -1).Value &
vbNewLine & vbNewLine & _
"Please review the Book Entry Checklist and
forward to the DMS Group when complete." _
& vbNewLine & vbNewLine & "Thank you - Account Management"
' looking to add one more line here that would attach a copy of "Account
Mgmt Checklist"
.Send
End With
Set iMsg = Nothing
End If
End If
Next cell
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
I'm a big fan of your CDO procedure that sends emails from Excel avoiding
the security warnings – great idea. I'm currently using one of your send
programs and I'm wondering if you could help me to add on last step.
After reviewing your other email macros with added text body, I can’t quite
find one that exactly covers the one piece I need to add. I just need one
additional line of code to attach a copy of the “Account Mgmt Checklist†to
the second group in the program (noted in the routine). These recipients are
already pre-determined by front side by programming. The second part of the
code looks for "Sales" as the determinant for those recipients who would
receive the attachment. The “Sales†group would receive a spreadsheet and
message vs. the “Yes†group just getting the message.
Any thoughts would be greatly appreciated.
Thanks so much and I really think this CDO process is slick - Jenny B.
Option Explicit
Sub CDO_Personalized_Mail_Body()
Dim iMsg As Object
Dim iConf As Object
Dim cell As Range
Dim Flds As Variant
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set iConf = CreateObject("CDO.Configuration")
For Each cell In
Sheets("Sheet1").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Offset(0, 1).Value <> "" Then
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value)
= "yes" Then
Set iMsg = CreateObject("CDO.Message")
With iMsg
Set .Configuration = iConf
.To = cell.Value
.From = """Account Mgmt"" <[email protected]>"
.Subject = "New Book Entry Checklist" & " - " &
Sheets("Account Mgmt Checklist").Range("F5").Value
.TextBody = "Hello " & cell.Offset(0, -1).Value &
vbNewLine & vbNewLine & _
"Please review the Book Entry Checklist and
forward to the DMS Group when complete." _
& vbNewLine & vbNewLine & "Thank you - Account Management"
.Send
End With
Set iMsg = Nothing
End If
End If
If cell.Offset(0, 1).Value <> "" Then
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value)
= "sales" Then
Set iMsg = CreateObject("CDO.Message")
With iMsg
Set .Configuration = iConf
.To = cell.Value
.From = """Account Mgmt"" <[email protected]>"
.Subject = "New Book Entry Checklist" & " - " &
Sheets("Account Mgmt Checklist").Range("F5").Value
.TextBody = "Hello " & cell.Offset(0, -1).Value &
vbNewLine & vbNewLine & _
"Please review the Book Entry Checklist and
forward to the DMS Group when complete." _
& vbNewLine & vbNewLine & "Thank you - Account Management"
' looking to add one more line here that would attach a copy of "Account
Mgmt Checklist"
.Send
End With
Set iMsg = Nothing
End If
End If
Next cell
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub