I have created the basic code to have a macro that will set my follow up as two business days from "now".
Now I want to set it to set a Category (this should be easy) and skip Holidays.
Is there function I can use to Skip Holidays? OR should I just build a Case structure around holidays that I am aware of?
- Matt
"If I must boast, I will boast of the things that show my weakness"
- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008
Code:
Sub SetFollowupTo2BusinessDays()
Dim sel As Outlook.Selection
Set sel = Application.ActiveExplorer.Selection
Dim item As Object
Dim i As Integer
For i = 1 To sel.Count
Set item = sel.item(i)
If item.Class = olMail Then
Dim mail As MailItem
Set mail = item
mail.MarkAsTask (olMarkNoDate)
mail.TaskStartDate = SetDate(Now)
mail.Save
End If
Next i
End Sub
Private Function SetDate(pDate As Date) As Date
Select Case Weekday(pDate) '1 = Sunday, 7 = Saturday
Case 2, 3, 4
BaseAdd = 2
Case 5, 6
BaseAdd = 4
Case Else
msg = MsgBox("This is a Weekend", vbOKOnly, "Weekend")
End Select
SetLastDate = DateAdd("d", BaseAdd, pDate)
End Function
Now I want to set it to set a Category (this should be easy) and skip Holidays.
Is there function I can use to Skip Holidays? OR should I just build a Case structure around holidays that I am aware of?
- Matt
"If I must boast, I will boast of the things that show my weakness"
- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008