Advertisement
Advertisement
| 09.25.2008 at 08:35AM PDT, ID: 23762920 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: |
Option Explicit
Sub ProcessAbsentees()
Dim dt As Date
Dim rw As Long
Dim col As Integer
Dim rowcount As Long
Dim rng As Range, pRange As Range, C As Range, p As Range
Dim firstAddress As String
With ThisWorkbook.ActiveSheet
dt = Date
rw = .Range("B" & ActiveSheet.Rows.Count).End(xlUp).Row
Set rng = .Range("a3:z3")
Set rng = rng.Cells.Find(dt, LookIn:=xlValues).Offset(0, 1)
Set rng = Range(Cells(7, rng.Column), Cells(ActiveSheet.UsedRange.Rows.Count, rng.Column))
With rng
Set C = .Find("N", , xlValues, xlWhole)
If Not C Is Nothing Then
firstAddress = C.Address
Set pRange = C
Do
Set C = .FindNext(C)
Set pRange = Union(C, pRange)
Loop While Not C Is Nothing And C.Address <> firstAddress
End If
For Each p In pRange
Cells(6, rng.Column - 1).FormulaR1C1 = "=SUMPRODUCT((R[1]C:R[200]C=R[" & p.Row - 6 & "]C)*(R[1]C[1]:R[200]C[1]=""Y""))"
Call MailEm(p.Offset(0, -1).Value, Cells(p.Row, "A").Value, Cells(6, rng.Column - 1).Value)
Next
End With
Cells(6, rng.Column - 1).Clear
End With
End Sub
Sub MailEm(siteName As String, empName As String, empNum As String)
Dim olApp 'As Outlook.Application
Dim olNS 'As Outlook.Namespace
Dim mai 'As mailitem
Set olApp = CreateObject("outlook.application")
Dim siteList As Range, C As Range
Dim oContact As String, OContactTel
Set siteList = ThisWorkbook.Sheets("Site List").Columns("B:B")
Set C = siteList.Find(siteName, , xlValues, xlWhole)
If Not C Is Nothing Then
oContact = C.Offset(0, 2)
OContactTel = C.Offset(0, 3)
Else
oContact = "absences@advent.local"
End If
If OContactTel = "" Then OContactTel = "XXXXX"
Set mai = olApp.CreateItem(0)
mai.To = oContact
mai.Subject = C.Offset(0, -1) & " Abscenses " & Date
mai.Body = "Hi " & C.Offset(0, 1) & "," & vbCrLf & vbCrLf
mai.Body = mai.Body & "Unfortunately " & empName & " has called in sick this morning however there will still be " & empNum & " other operatives on site. Our apologies for any inconviniencies this may cause, a representative from Advanced Ventilation will contact you after 9:00am on " & OContactTel
mai.Body = mai.Body & vbCrLf & vbCrLf & "Kind Regards" & vbCrLf & vbCrLf & "Advanced Ventilation - In Partnership with Nuaire"
mai.Body = mai.Body & "Tel: (01204) 523384"
mai.Body = mai.Body & "Fax: (01204) 389849"
mai.Body = mai.Body & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "This is an automated email to use an alternative email for this information please contact Adanced Ventilation"
mai.Send
Set mai = Nothing
Set olApp = Nothing
End Sub
|