' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Function PayDateFirst() As Date
    Dim d As Date
    d = Now()
    d = DateSerial(Year(d), Month(d), 1)
    d = DateAdd("m", 2, d)
    PayDateFirst = d
End Function

Function PayDateLast() As Date
    Dim d As Date
    d = Now()
    d = DateSerial(Year(d), Month(d), 1)
    d = DateAdd("m", 2, d)
    d = DateAdd("d", -1, d)
    PayDateLast = d
End Function

Function test()
    MsgBox CStr(PayDateLast()) & " " & CStr(PayDateFirst())
End Function
