Private Function MonthDate(MyDate As Date) As Integer
Dim tmpDate As Date
tmpDate = DatePart("yyyy", MyDate) & "-" & DatePart("m", MyDate) & "-01"
MonthDate = DateAdd("m", 1, tmpDate) - tmpDate
End Function
Private Sub Command1_Click()
aa = MonthDate(Text1.Text)
MsgBox aa
End Sub