Option
Explicit
Private
Sub
TextBox1_Change()
With
TextBox1
If
Right(.Text, 4)
Like
"A###"
Then
Application.EnableEvents =
False
.Value = ersetze_Abkuerzungen(.Text)
Application.EnableEvents =
True
Cells(1, 1).Value = .Text
End
If
End
With
End
Sub
Function
ersetze_Abkuerzungen(
ByVal
txt
As
String
)
As
String
Static
Dic
As
Object
If
Dic
Is
Nothing
Then
Set
Dic = CreateObject(
"Scripting.Dictionary"
)
Dic.Add
"A123"
,
"Kunde anschreiben"
Dic.Add
"A124"
,
"blabla4"
Dic.Add
"A125"
,
"blabla5"
End
If
If
Dic.Exists(Right(txt, 4))
Then
txt = Mid(txt, 1, Len(txt) - 4) & Dic(Right(txt, 4))
End
If
ersetze_Abkuerzungen = txt
End
Function