The following example prompts the user for a string value, uses the IsDate function to determine whether the string can be converted to a date, and then displays an appropriate message.
Sub CheckDate()
Dim strDate As String
strDate = InputBox("Enter string to display as a date.")
' Test variable.
If IsDate(strDate) Then
' If string is date, format and display in dialog.
MsgBox "The date is: " & Format(DateValue(strDate), _
"Long Date")
Else
MsgBox "The value you entered is not a date."
End If
End Sub