|  |  | 
              
              | 
                  | Title | Calculate the number of days in a month | 
|---|
 | Keywords | days, month, calendar | 
|---|
 | Categories | Utilities | 
|---|
 |  | 
 |  | Use CDate to convert the month (e.g. "April, 2000") into a date. The resulting date is the first of the month. 
Next use DateAdd to add 1 month, giving the first of the next month. Use DateDiff to find the number of days between these dates.
               |  | 
 |  
                | Private Sub cmdGo_Click()
Dim start_of_month As Date
Dim start_of_next_month As Date
    start_of_month = CDate(txtMonth.Text)
    start_of_next_month = DateAdd("m", 1, start_of_month)
    MsgBox "Days: " & Format$(DateDiff("d", start_of_month, _
        start_of_next_month))
End Sub |  |  |  |   |  |  |  |  |