05-28-2009, 05:12 PM
hi Tarry,
Use the below script
Thanks
Stephen
Use the below script
Code:
Text= DataTable("A", dtGlobalSheet)
Dim sText
'Splitting the given string with the delimiter _ and saving it in the array called sText
sText = Split(Text,"_")
'Displaying the length of character before _
Msgbox "First Seven Text before _ is: " &sText(0)
If len( sText(0)) >6 or len( sText(0)) <6Then
Msgbox"Lenght of character before _ is 6"
else
Msgbox"Lenght of character before _ is not equal to 6"
End If
'Displaying the lenght of character after and before _
Msgbox "Second Six Character (yyyymm) after and before _ is: " &sText(1)
'i dont think we can validate the second condition but any how we can check weather the month is valid or not
'Splliting the date as YYYY and MM using mid function
mnth = Mid (sText(1),5)
If mnth < 0 or mnth > 12 Then
msgbox "The date format is not valid"
else
yr = Mid (sText(1),1,4)
msgbox "Date is "&MonthName(mnth)&yr
End If
' Comparastion btw two date
Msgbox "Third Six Character (yyyymm) after 2nd _ is: " &sText(2)
If sText(2) > sText(1) Then
Msgbox "Second date is Greater than the First"
Else
Msgbox "Second date is Not Greater than the First"
End If
Thanks
Stephen