Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook - Set Flag / Category for Two Business Days from Now

Status
Not open for further replies.

tqeonline

MIS
Oct 5, 2009
304
US
I have created the basic code to have a macro that will set my follow up as two business days from "now".

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
 
It would be beneficial for you to have a little table with holidays and check against that.
(US) 4th of July is always on the 4th, Christmas is always on Dec. 25, New Year on the 1st of Jan, but other holidays are not so easy to predict (imagine to calculate Easter… :) )


Have fun.

---- Andy
 
hi,

I work in a major aerospace company. I have worked in this industry for over 30 years in 3 different firms.

In every company, we never use formulas to calculate manufacturing or accounting calendar days. It is ALL in a table. It is the most fail-safe way to assure that everyone is on the same calendar/day, be it for manufacturing or accounting. A company may even have a dozen or so different calendars for different functions like accounting or manufacturing, or different locations. That STILL would all be in a common table, as an enterprise needs to unfailingly relate each calendar to every other calendar as need be.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Maybe find a relevent iCal xml that you can subscribe/download and query for holidays to skip.

Never knock on Death's door: ring the bell and run away! Death really hates that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top