S
Sardonic
Dear All,
I am writing in VBA for Excel 2003 a function to validate Date values which
are inputted via a set of combo boxes, one each for day, month and date. I
am currently puzzling how to go about convering the string "DD\MM\YYYY" into
a true date value to check if it is a real date.
The code is given below - I'm sure I'm missing something simple....
Thanks for any assistance.
Regards
Function Parse_Date(Day As String, Month As String, Year As String, Source
As String) As Boolean
Dim FullDate As String
FullDate = Day & "/" & Month & "/" & Year
Dim DateFormatted As Date
DateFormatted = Format(FullDate, "longdate")
Do While (IsDate(DateFormatted) <> True)
MsgBox (FullDate & " entered in " & Source & " is not a real date.")
Loop
Parse_Date = True
End Function
I am writing in VBA for Excel 2003 a function to validate Date values which
are inputted via a set of combo boxes, one each for day, month and date. I
am currently puzzling how to go about convering the string "DD\MM\YYYY" into
a true date value to check if it is a real date.
The code is given below - I'm sure I'm missing something simple....
Thanks for any assistance.
Regards
Function Parse_Date(Day As String, Month As String, Year As String, Source
As String) As Boolean
Dim FullDate As String
FullDate = Day & "/" & Month & "/" & Year
Dim DateFormatted As Date
DateFormatted = Format(FullDate, "longdate")
Do While (IsDate(DateFormatted) <> True)
MsgBox (FullDate & " entered in " & Source & " is not a real date.")
Loop
Parse_Date = True
End Function