Option
Explicit
Public
Sub
Test()
Dim
strExample
As
String
Dim
strSearchKey
As
String
Dim
enmCompareMethod
As
VbCompareMethod
Dim
lngStart
As
Long
strExample =
"Apfel 1 Banane 2 Kirsche 3 apfel 4 Himbeere 5 KirSche 6 Apfel 7 BAnane 8 banane 9"
strSearchKey =
"Banane"
enmCompareMethod = vbTextCompare
lngStart = InStr(1, strExample, strSearchKey, enmCompareMethod)
Debug.Print
"[Neuer Suchvorgang]"
Do
While
lngStart > 0
Debug.Print Mid$(strExample, lngStart, Len(strSearchKey)), Mid$(strExample, lngStart + Len(strSearchKey) + 1, 1)
lngStart = InStr(lngStart + Len(strSearchKey), strExample, strSearchKey, enmCompareMethod)
Loop
End
Sub