ERFORDERLICHE
OBJEKTE
1 Commandbutton (Command 1)
1 Textbox (Text1, Multiline=True)
FORM-CODE
Private Function Replace(ByVal zu_durchsuchender_Text As String, _
ByVal Was_ersetzen As String, ByVal durch_was_ersetzen As String) _
As String
If Was_ersetzen = "" Then Exit Function
If zu_durchsuchender_Text = "" Then Exit Function
Dim i As Integer, L As Integer, t As String, P As Integer
L = Len(Was_ersetzen)
P = InStr(zu_durchsuchender_Text, Was_ersetzen)
While P > 0
t = t & Left(zu_durchsuchender_Text, P - 1) & durch_was_ersetzen
zu_durchsuchender_Text = Mid(zu_durchsuchender_Text, P + L)
P = InStr(zu_durchsuchender_Text, Was_ersetzen)
Wend
Replace = t & zu_durchsuchender_Text
End Function
Private Sub Form_Load()
t = ""
For x = 1 To 100
t = t & "Testtext Nr. " & x & Chr(13) & Chr(10)
Next
Text1.Text = t
End Sub
Private Sub Command1_Click()
s = Replace(Text1, "Nr.", "Nummer")
Text1.Text = s
End Sub
|