The Ruff Report
New Member
- Joined
- Jun 17, 2023
- Messages
- 19
- Office Version
- 365
- Platform
- Windows
Looking for some help. This macro works but I want to cc multiple email addresses (up to 7) instead of just the one cc address in cell C2.
-----------------------------------------------------------
Dim OutApp As Object
Dim OutMail As Object
Dim EmailSubject As String
Dim EmailSendTo As String
Dim MailBody As String
Dim cell As Range
Path = "C:\Users\bobb\Desktop\Reports\"
Set Rng = Range(Range("B2"), Range("B" & Rows.Count).End(xlUp))
For Each cell In Rng
Rw = cell.Row
If cell.Value <> "" Then
EmailSendTo = cell.Value
Company = cell.Offset(0, -1)
ccTo = cell.Offset(0, 1)
AttachFileName = Path & cell.Offset(0, 8).Value
'Email Subject
EmailSubject = "12 2023 Receipts"
'Mail Body string
strbody = "Good Morning," & vbNewLine & vbNewLine & _
"Attached are receipts." & vbNewLine & _
"Thanks," & vbNewLine & _
"Bob"
'Send Mail
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(o)
With OutMail
.Subject = EmailSubject
.To = EmailSendTo
.CC = ccTo
.SentOnBehalfOfName = "bobb@mycompany.com"
.Body = strbody
.Attachments.Add (AttachFileName)
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
strbody = ""
End If
Next
End Sub
-----------------------------------------------------------
Dim OutApp As Object
Dim OutMail As Object
Dim EmailSubject As String
Dim EmailSendTo As String
Dim MailBody As String
Dim cell As Range
Path = "C:\Users\bobb\Desktop\Reports\"
Set Rng = Range(Range("B2"), Range("B" & Rows.Count).End(xlUp))
For Each cell In Rng
Rw = cell.Row
If cell.Value <> "" Then
EmailSendTo = cell.Value
Company = cell.Offset(0, -1)
ccTo = cell.Offset(0, 1)
AttachFileName = Path & cell.Offset(0, 8).Value
'Email Subject
EmailSubject = "12 2023 Receipts"
'Mail Body string
strbody = "Good Morning," & vbNewLine & vbNewLine & _
"Attached are receipts." & vbNewLine & _
"Thanks," & vbNewLine & _
"Bob"
'Send Mail
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(o)
With OutMail
.Subject = EmailSubject
.To = EmailSendTo
.CC = ccTo
.SentOnBehalfOfName = "bobb@mycompany.com"
.Body = strbody
.Attachments.Add (AttachFileName)
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
strbody = ""
End If
Next
End Sub