Auszug aus einem VB - Programm

private Sub vergleichen_Click()
  Dim zelle, x As Integer, Zeile As Integer, Y As Integer, L As Integer, anzahl As Integer
  Dim S1$, S2$, temp$, b$, Start%
  Dim Temp2$, B2$, Start2%, X2%, Tcode%, nix
    Zeile = Len(Form1.RichTextBox2.Text)
    Do While x < Len(Form1.RichTextBox2.Text)
        With Form1.RichTextBox2
            .SelStart = x
            .SelLength = 1
            Start = x
            temp = ""
            Start2 = X2
            Temp2 = ""
                Do
                    .SelStart = x
                    .SelLength = 1
                    b = .SelText
                    If b = "" Then
                        x = x + 2
                        Exit Do
                    End If
                    temp = temp + b
                    x = x + 1
                Loop
            S1 = temp
            '******* Tastatur abfragen auf ESC *************
            If GetAsyncKeyState(27) Then
                Form1.RichTextBox1.SetFocus
                Exit Do
            End If
            With Form1.RichTextBox1
                Do
                    .SelStart = X2
                    .SelLength = 1
                    B2 = .SelText
                If B2 <> "" Then
                nix = Asc(B2)
                End If
                    If B2 = "" Then
                        X2 = X2 + 2
                        Exit Do
                    End If
                    Temp2 = Temp2 + B2
                    X2 = X2 + 1
                Loop
                S2 = Temp2
            End With
            If S1 <> S2 Then
                .SelStart = Start
                .SelLength = x - Start
                .SelBold = True
                .SelColor = RGB(0, 0, 255) 'Index = 3
                anzahl = anzahl + 1
                L = Len(S1)
                For Y = 1 To L
                    If Mid(S1, Y, 1) <> Mid(S2, Y, 1) Then
                        .SelStart = Start + Y - 1
                        .SelLength = 1
                        .SelColor = RGB(255, 0, 0)
                    End If
                Next
            Else
                .SelStart = Start
                .SelLength = x - Start
                .SelBold = False
                .SelColor = RGB(0, 0, 0)
            End If
        End With
    Loop
    zelle = MsgBox("Es sind(ist) " & anzahl & " Zeile(n) verkehrt", vbOKOnly, "Auswertung")
End Sub