AW: Monatsname in Variable
28.03.2006 08:05:11
Heiko
Hallo Chris,
Reinhard war zwar schneller, aber hier auch noch meine Lösung (Gleicher Ansatzt wie bei Reinhard)
Function PruefeMonat(strMonat As String) As Integer
On Error GoTo errorhandler
PruefeMonat = Month(CDate("1." & strMonat & ".1"))
Exit Function
errorhandler:
' MsgBox "Der Text '" & strMonat & "' wurde nicht als Monatsname erkannt !", vbCritical
PruefeMonat = -1
End Function
Sub test()
MsgBox PruefeMonat("jan")
MsgBox PruefeMonat("janu")
MsgBox PruefeMonat("Januar")
MsgBox PruefeMonat("Dezember")
MsgBox PruefeMonat("December")
End Sub
Gruß Heiko
PS: Rückmeldung wäre nett !