IsDate (function)

Syntax

IsDate(expression)

Description

Returns True if expression can be legally converted to a date; returns False otherwise.

Example

Sub Main()
  Dim a As Variant
Retry:
  a = InputBox("Enter a date.","Enter Date")
  If IsDate(a) Then
    MsgBox Format(a,"long date")
  Else
    Msgbox "Not quite, please try again!"
    Goto Retry
  End If
End Sub

See Also

Variant (data type); IsEmpty (function); IsError (function); IsObject (function); VarType (function); IsNull (function).

More information

I