Gruppe
UDF
Problem
Wie kann ich Telefonnummern nach Vorwahl und Anschluß aufteilen? Die Nummern liegen in den Formaten (02683)949049, 02683/949049 und 02683-949049 vor.
StandardModule: basMain
Function Vorwahl(txt As String) As String
Dim sTxt As String
If InStr(txt, ")") > 0 Then
sTxt = Right(txt, Len(txt) - 1)
sTxt = Left(sTxt, InStr(sTxt, ")") - 1)
ElseIf InStr(txt, "/") > 0 Then
sTxt = Left(txt, InStr(txt, "/") - 1)
ElseIf InStr(txt, "-") > 0 Then
sTxt = Left(txt, InStr(txt, "-") - 1)
Else
sTxt = ""
End If
Vorwahl = sTxt
End Function
Function Nr(txt As String) As String
Dim sTxt As String
If InStr(txt, ")") > 0 Then
sTxt = Right(txt, Len(txt) - InStr(txt, ")"))
ElseIf InStr(txt, "/") > 0 Then
sTxt = Right(txt, Len(txt) - InStr(txt, "/"))
ElseIf InStr(txt, "-") > 0 Then
sTxt = Right(txt, Len(txt) - InStr(txt, "-"))
Else
sTxt = txt
End If
Nr = sTxt
End Function