我正在尝试写一个学校项目的用户年龄,并且我很难让年(Now())实际返回当前年份。
Private Sub cmdOldEnough_Click()
Dim strCalculateAge As String
Dim dtToday As Date
strCalculateAge = Right(inpAge, 4)
dtToday = Year(Now())
MsgBox dtToday
End Sub
当前代码返回日期07/08/1905。非常感谢!
答案 0 :(得分:1)
您不需要Date
,需要Long
:
Sub marine()
Dim dtToday As Long
dtToday = Year(Now())
MsgBox dtToday
End Sub