FlowFact - Entwicklungstools

zurück

Function - IsFeiertag
Datum auf Feiertag prüfen

  Function IsFeiertag(ByVal datDate As Date) As String  
 


datDate: Der zu untersuchende Datumswert
Rückgabe: Der Name des Feiertags


Public Function IsFeiertag(ByVal datDate As Date) As String
    Dim strResult As String
    Dim i As Long
    Dim dateAInt As Date
    Dim lngYear As Long

    strResult = ""

    On Error GoTo Error_Sub
    lngYear = Year(datDate)
    If m_oLegalHolidays.Exists(lngYear) = False Then
        Set m_oLegalHolidays(lngYear) = CreateObject("clacastdc10.cLegalHolidays")
        m_oLegalHolidays(lngYear).Eintragen lngYear
    End If

    dateAInt = Int(datDate)
    For i = 1 To m_oLegalHolidays(lngYear).Count
        If m_oLegalHolidays(lngYear).Day(i) = dateAInt Then
            strResult = m_oLegalHolidays(lngYear).Description(i)
            If strResult = "" Then
                strResult = "???"
            End If
            Exit Function
        End If
    Next

    IsFeiertag = strResult
    Exit Function
Error_Sub:
    IsFeiertag = strResult
End Function