Sub ESS_Mail()
'
' Email all supported held in excel file and _
attach his/her file from Monthly Query results
'
Dim r As Range, c As Range
Dim rLookfor As Range
Dim rLookin As Range
With Application
Application.ScreenUpdating = False
Application.EnableEvents = False
End With
With Worksheets("ESS_Mail")
Set rLookin = .Range(.Cells(2, "E"), .Cells(.UsedRange.Rows.Count, "E"))
End With
For Each r In rLookin
If Trim(r.Value) <> "" Then
' Now Email and attach his/her data file
ESubject = "ESS Report"
ESendto = Replace(r.Value, "mailto:", "")
EFilename = r.Offset(0, -4)
Set App = CreateObject("Outlook.Application")
Set Itm = App.CreateItem(0)
With Itm
.Subject = ESubject
.From = EFrom
.To = ESendto
' Debug.Print EFilename
'.CC = CCTo
.Attachments.Add "G:\Marketing\Management and admin\Monthly Management Reports\ESS & EIT Monthly Reporting\FY 09-10\2010 03\ESS_Reports\" & EFilename
.Display ' This property is used when you want _
the user to see email and manually send.
.Send
End With
Set App = Nothing
Set Itm = Nothing
End If
Next
With Application2
Application.ScreenUpdating = True
Application.EnableEvents = True
End With
End Sub