Gruppe
DatumZeit
Problem
Aus dem ein Datum enthaltenden String soll das Jahr ausgefiltert werden.
StandardModule: Modul1
Function GebJahr(txt As String) As Integer
Dim intCounter As Integer
txt = txt & " "
For intCounter = 1 To Len(txt) - 4
If Mid(txt, intCounter, 5) Like "*#### *" Then
GebJahr = Mid(txt, intCounter, 4)
Exit Function
End If
Next intCounter
End Function
Sub Aufruf()
Dim x As Integer
x = GebJahr("Freiburg am 22. Juli 1955")
MsgBox x
End Sub