Sub create_multiple_emails()
Dim wb As Workbook, sh As Worksheet, c As Range, m As Range
Dim sBody As String, wFile As String
Dim dam As Object, dict As Object
'
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'
Set sh = ActiveSheet
Set dict = CreateObject("scripting.dictionary")
If sh.AutoFilterMode Then sh.AutoFilterMode = False
sh.Range("A1").AutoFilter Field:=20, Criteria1:=xlFilterToday, Operator:=xlFilterDynamic
For Each c In sh.Range("C2", sh.Range("C" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
If Not dict.exists(c.Value) Then
dict(c.Value) = dict(c.Value)
sh.Range("A1").AutoFilter 3, c
Set wb = Workbooks.Add
sh.AutoFilter.Range.EntireRow.Copy Range("A1")
wFile = ThisWorkbook.Path & "\" & Format(Date, "dd-mm-yyyy") & " " & c.Value & ".xlsx"
wb.SaveAs wFile
wb.Close False
Set dam = CreateObject("Outlook.Application").CreateItem(0)
'
'[COLOR=#ff0000]Mail Information[/COLOR]
dam.To = "[COLOR=#ff0000]email@mail.com[/COLOR]"
dam.Subject = [COLOR=#ff0000]"Subject ?????[/COLOR]"
dam.Body = "[COLOR=#ff0000]Hi XXX, Please see attached. Regards XXX[/COLOR]"
dam.Attachments.Add wFile
dam.Display 'use .Send to send
End If
Next
sh.ShowAllData
MsgBox "Emails sent"
End Sub