Private Function GetDaysInYear(d As Date) As Integer()
Dim dt As Date, i As Integer, x(7) As Integer, c As Integer, g As Date
g = CDate(Format$(d, "mm/yyyy"))
c = IIf(Year(d) Mod 4 = 0, 366, 365)
For dt = g To DateAdd("d", c - 1, g)
x(Weekday(dt)) = x(Weekday(dt)) + 1
Next
GetDaysInYear = x
End Function
Private Sub Command2_Click()
Dim d() As Integer
d = GetDaysInYear(#2/22/2011#)
MsgBox d(1) + d(2) + d(3) + d(4) + d(5) + d(6) + d(7)
End Sub