How do I define a function to return an Array?
Seems like is should be straight forward, but I can't find the right syntax.
Seems like is should be straight forward, but I can't find the right syntax.
Code:
Public Function DueDate(Received As Date, ReplyinDays As Integer)
'Returns an array of three dates: [Due1, Due2, Due3] based on Due3 = Recived + ReplyinDays
'Everything in calendar days.
'If a due date falls on weekend, corrected to the Friday before.
Dim Due1 As Date 'Subject expert
Dim Due2 As Date 'Internal Management
Dim Due3 As Date 'To Client
Due1 = FridayBefore(DateAdd("d", ReplyinDays - 14, Received))
Due2 = FridayBefore(DateAdd("d", ReplyinDays - 10, Received))
Due3 = FridayBefore(DateAdd("d", ReplyinDays, Received))
DueDate = Array(Due1, Due2, Due3)
End Function
Public Function FridayBefore(Feed As Date) As Date
Dim WhatDay As Integer
WhatDay = Weekday(Feed)
Select Case WhatDay
Case 7 'Saturday
FridayBefore = DateAdd("d", -1, Feed)
Case 1 'Sunday
FridayBefore = DateAdd("d", -2, Feed)
Case Else
FridayBefore = Feed
End Select
End Function