LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Converting a String into a date format

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a string into a number format Albert Excel Discussion (Misc queries) 1 April 17th 08 10:18 AM
Converting a time format to a String format in Excel Bill Partridge Excel Discussion (Misc queries) 3 October 3rd 07 11:48 AM
Converting a Date to a string Sworkhard Excel Programming 1 July 27th 04 09:44 PM
Converting a Date to a string Sworkhard Excel Programming 2 July 27th 04 09:44 PM
Converting a string date into a Excel Date Phillips Excel Programming 0 November 24th 03 08:54 PM


All times are GMT +1. The time now is 06:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"