Ja hamma denn heut' schoa Weihnoachten? ;D
Function GetDateArray (vStartDate As Variant, vEndDate As Variant) As Variant
'==================================================================================================================
' Purpose: Build from given start end and end date an array of date/time variants containing all days between start and end date
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Arguments:
' vStartDate - First date of the period (included) - must be variant of type "Date/Time"
' vLastDate - Last date of the period (included) - must be variant of type "Date/Time"
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Returns: An array of variants containing all days between start and end date
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Created by: Bernhard Koehler on 10.04.2004 Modified by:
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Changes:
'==================================================================================================================
Dim vResult () As Variant
Dim iLoop As Integer
On Error Goto ErrorRoutine
'Check for correct values:
If (Datatype (vStartDate) <> V_DATE) Or (Datatype (vEndDate) <> V_DATE) Then
Exit Function
End If
If vEndDate - vStartDate < 0 Then
Exit Function
End If
iLoop = vEndDate - vStartDate
Redim vResult (0 To iLoop)
vResult (0) = vStartDate
For iLoop = 1 To Ubound (vResult)
vResult (iLoop) = vStartDate + iLoop
Next
GetDateArray = vResult
Exit Function
ErrorRoutine:
Call ErrorHandler ("GetDateTimeArray")
Exit Function
End Function
HTH,
Bernhard
PS: ErrorHandler ist selbst zu schreiben!