-
Hello,
Is there any possible way that you can use an array or something like it to fill a list box with all the possible dates of the year, with just the date and month and not the year????
(ie) having it automatically display 1st January til 31st December...without the year being shown...????
Hope someone can help...
Thanks,
Andy............
-
This code seems to work. You pass in the year that you want the dates for and it formats the date to display only the day and Month. This code puts the dates in a text box, but you can modify it to do what you are looking for I think.
Code:
Private Function PopulateDates(strForYear As String)
Dim dtStartDate As Date
Dim dtCurrentDate As Date
dtStartDate = CDate("01/01/" & strForYear)
dtCurrentDate = dtStartDate
Do While strForYear = Format(dtCurrentDate, "yyyy")
Text1.Text = Text1.Text & Format(dtCurrentDate, "dd mmm") & vbCrLf
dtCurrentDate = dtCurrentDate + 1
Loop
End Function
Private Sub Command1_Click()
PopulateDates (2000)
End Sub