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
| Function GetPattern(olkPat As Outlook.RecurrencePattern) As String
Select Case olkPat.RecurrenceType
Case olRecursDaily
GetPattern = "Daily every " & olkPat.Interval & " day(s)"
Case olRecursWeekly
GetPattern = "Weekly on " & ConvertDaysOfWeekMask(olkPat.DayOfWeekMask)
Case olRecursMonthly
GetPattern = "Every " & olkPat.Interval & " month(s) on the " & NumericSuffix(olkPat.DayOfMonth)
Case olRecursMonthNth
GetPattern = "Every " & olkPat.Interval & " month(s) on the " & NumericSuffix(olkPat.Instance) & " " & ConvertDaysOfWeekMask(olkPat.DayOfWeekMask)
Case olRecursYearly
GetPattern = "Yearly on the " & NumericSuffix(olkPat.DayOfMonth) & " of " & MonthName(olkPat.MonthOfYear)
Case olRecursYearNth
GetPattern = "Yearly on the " & NumericSuffix(olkPat.Instance) & " " & ConvertDaysOfWeekMask(olkPat.DayOfWeekMask) & " of " & MonthName(olkPat.MonthOfYear)
End Select
End Function
Function ConvertDaysOfWeekMask(intMask As Integer) As String
If intMask And olSunday Then
ConvertDaysOfWeekMask = ConvertDaysOfWeekMask & "Sun,"
End If
If intMask And olMonday Then
ConvertDaysOfWeekMask = ConvertDaysOfWeekMask & "Mon,"
End If
If intMask And olTuesday Then
ConvertDaysOfWeekMask = ConvertDaysOfWeekMask & "Tue,"
End If
If intMask And olWednesday Then
ConvertDaysOfWeekMask = ConvertDaysOfWeekMask & "Wed,"
End If
If intMask And olThursday Then
ConvertDaysOfWeekMask = ConvertDaysOfWeekMask & "Thu,"
End If
If intMask And olFriday Then
ConvertDaysOfWeekMask = ConvertDaysOfWeekMask & "Fri,"
End If
If intMask And olSaturday Then
ConvertDaysOfWeekMask = ConvertDaysOfWeekMask & "Sat,"
End If
If Len(ConvertDaysOfWeekMask) > 0 Then
ConvertDaysOfWeekMask = Left(ConvertDaysOfWeekMask, Len(ConvertDaysOfWeekMask) - 1)
End If
End Function |
Partager