Hi,
I have one code where I want to send outlook mail.
Code is working fine except I can sent only one attachment. (Provided in path)
Below code is useful because it allows me to send 50 emails at a time (I need to create separate sheet and include every person name to whom I want to send mail)
Can anyone modify this code to include 2 or more than 2 attachments?
Thanks
I have one code where I want to send outlook mail.
Code is working fine except I can sent only one attachment. (Provided in path)
Below code is useful because it allows me to send 50 emails at a time (I need to create separate sheet and include every person name to whom I want to send mail)
Can anyone modify this code to include 2 or more than 2 attachments?
Code:
Sub Mail_ActiveSheet()
Dim outapp As Object, cl As Range, bodytekst As Variant, outmail As Object, strlocation As String
strlocation = "C:\Users\vv\Documents\Automation Work\Daily File\Daily File Report - 06-01-2017.xlsm"
With CreateObject("Outlook.Application").createitem(0)
For Each cl In ThisWorkbook.Sheets("Distribution List").Columns(2).SpecialCells(2)
If cl.Value Like "?*@?*.?*" And LCase(cl.Offset(0, 1).Value) = "yes" Then
If strto = "" Then strto = stro & ";"
strto = strto & cl.Value & ";"
End If
Next cl
For Each cl In ThisWorkbook.Sheets("Distribution List").Columns(2).SpecialCells(2)
If cl.Value Like "?*@?*.?*" And LCase(cl.Offset(0, 2).Value) = "yes" Then
If strcc = "" Then strcc = strcc & ";"
strcc = strcc & cl.Value & ";"
End If
Next cl
.To = strto
.CC = strcc
.BCC = ""
.Subject = "AGI US Retail Daily Focus Fund Sales - as of "
.Body = "** Please see bottom of each page for list of data items included and excluded in attached report"
.Attachments.Add (strlocation)
.display
End With
MsgBox "Your Mail is ready"
End Sub
Last edited by a moderator: