Thursday, August 12, 2010

Visual Basic String Function : MonthName

Purpose : MonthName return the name of the month in which the numeric equivalent was passed.

Syntax :
sMonth = MonthName ( MonthNbr , [ Abbrev ] )

MonthNbr : A numeric value designating a month.
Abbrev : A Boolean value that indicates whether the month will return abbreviated or fully spelled out. The default value is False ; therefore, if this argument is omitted, the month is fully spelled out. Abbrev is optional.

Function SpellMonth ( sString as String ) as String

If IsNumeric ( sString ) Then
If Val ( sString ) > 0 And Val ( sString ) < 13 Then
SpellMonth = MonthName ( sString)
Else
MsgBox sString & " is not a valid entry "
End If
Else
MsgBox sString & " is not a valid entry "
End If

End Function

No comments:

Post a Comment