Private Function BepaalFeestdagOmschr(datum As Date) As String
Dim dag As Date
Dim Omschr(5) As String
Dim OmschrDate(5) As Date
On Error GoTo BepaalFeestdagOmschr_Error
Pasen = Paasdag(Year(datum))
Nieuwjaarsdag = DateValue("1-1-" & Year(datum))
Koninginnedag = DateValue("30-4-" & Year(datum))
Eerste_Kerstdag = DateValue("25-12-" & Year(datum))
Tweede_Kerstdag = DateValue("26-12-" & Year(datum))
Bevrijdingsdag = DateValue("5-5-" & Year(datum))
Goede_Vrijdag = Pasen - 2
Eerste_Paasdag = Pasen
Tweede_Paasdag = Pasen + 1
Hemelvaart = Pasen + 39
Eerste_Pinksterdag = Pasen + 49
Tweede_Pinksterdag = Pasen + 50
w = BepaalDagenMaand(datum)
dag = datum
Feestdag = 0
For x = 1 To w
If Weekday(dag) > 1 And Weekday(dag) < 7 Then
Select Case dag
Case Nieuwjaarsdag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "Nieuwjaarsdag"
OmschrDate(Feestdag) = dag
Case Koninginnedag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "Koninginnedag"
OmschrDate(Feestdag) = dag
Case Eerste_Kerstdag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "1e Kerstdag"
OmschrDate(Feestdag) = dag
Case Tweede_Kerstdag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "2e Kerstdag"
OmschrDate(Feestdag) = dag
Case Bevrijdingsdag
If Year(dag) Mod 5 = 0 Then
Feestdag = Feestdag + 1
Omschr(Feestdag) = "Bevrijdingsdag"
OmschrDate(Feestdag) = dag
End If
Case Goede_Vrijdag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "Goede vrijdag"
OmschrDate(Feestdag) = dag
Case Eerste_Paasdag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "1e Paasdag"
OmschrDate(Feestdag) = dag
Case Tweede_Paasdag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "2e Paasdag"
OmschrDate(Feestdag) = dag
Case Hemelvaart
Feestdag = Feestdag + 1
Omschr(Feestdag) = "Hemelvaartsdag"
OmschrDate(Feestdag) = dag
Case Eerste_Pinksterdag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "1e Pinksterdag"
OmschrDate(Feestdag) = dag
Case Tweede_Pinksterdag
Feestdag = Feestdag + 1
Omschr(Feestdag) = "2e Pinksterdag"
OmschrDate(Feestdag) = dag
Case Else
End Select
End If
dag = dag + 1
Next x
'MsgBox Omschr(1) & feestdag
If Feestdag > 0 Then
If Feestdag = 1 Then
BepaalFeestdagOmschr = "Feestdag: " & Omschr(1) & " op " & OmschrDate(1)
Else
BepaalFeestdagOmschr = "Feestdagen: " & Omschr(1) & " op " & OmschrDate(1)
For x = 2 To Feestdag
If x < Feestdag Then
BepaalFeestdagOmschr = BepaalFeestdagOmschr & ", " & Omschr(x) & " op " & OmschrDate(x)
Else
BepaalFeestdagOmschr = BepaalFeestdagOmschr & " en " & Omschr(x) & " op " & OmschrDate(x)
End If
Next x
End If
End If
Exit Function
BepaalFeestdagOmschr_Error:
MsgBox "Foutje"
End Function