Hi,
I have now modified my code to compare each word.. however while highlighting it does some vague behaviour.. it does not highlight some parts of the text or highlights is wrongly.. can you tell me what am i missing in this code.
Private Sub CompareText1()
Dim txtold() As String, txtnew() As String
txtold = Split(InkOld.Value, " ")
txtnew = Split(InkNew.Value, " ")
ss = 0
ss1 = 0
If UBound(txtnew) > UBound(txtold) Then
ubb = UBound(txtold)
Else
ubb = UBound(txtnew)
End If
st = 1
For i = 0 To ubb
If StrComp(txtnew(i), txtold(i), vbTextCompare) = 0 Then
st = InStr(st, InkNew.Value, txtnew(i))
lenn = Len(txtnew(i))
InkNew.SelStart = st - 1
InkNew.SelLength = lenn + 1
InkNew.SelColor = vbGreen
Else
st = InStr(st, InkNew.Value, txtnew(i))
lenn = Len(txtnew(i))
InkNew.SelStart = st - 1
InkNew.SelLength = lenn + 2
InkNew.SelColor = vbRed
End If
Next
End Sub
Regards,
Mahie