See Also Example
Returns a value indicating whether or not a Variant
Syntax
IsDate(variant)
Remarks
The argument variant can be any Variant expression of VarType The IsDate function returns True if the Variant can legally be converted to a date; otherwise, it returns False. The range of valid dates is January 1, 100 A.D. through December 31, 9999 A.D.
CVDate Function
IsEmpty Function
IsNull Function
IsNumeric Function
VarType Function
The example evaluates TestVar to determine whether it can legally be converted to a numeric data type and displays an appropriate message. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim TestVar ' Declare variable.
TestVar = InputBox("Enter a string you'd like displayed as a date.")
If IsDate(TestVar) Then ' Test variable.
MsgBox "The date is: " & Format(CVDate(TestVar),"dddddd")
Else
MsgBox "What you entered doesn't make sense as a date."
End If
End Sub