Hi,
I have a code to compare contents of two text boxes and highlight the differences which is working fine but due to this even if one character has changed the entire text after the change is highlighted in red color.
what I want to do is to change this code to compare text line by line to highlight the differences.. Can you please help me with this..
The code that I already have is as below:
For i = 1 To Len(InkNew.Value)
InkNew.SelStart = i - 1
InkNew.SelLength = 1
If Mid(InkNew.Value, i, 1) = Mid(InkOld.Value, i, 1) Then
InkNew.SelStart = i
InkNew.SelLength = 1
InkNew.SelColor = vbBlack
Else
InkNew.SelStart = i - 2
InkNew.SelLength = 1
InkNew.SelColor = vbRed
End If
Next
x = x + 1
I have a code to compare contents of two text boxes and highlight the differences which is working fine but due to this even if one character has changed the entire text after the change is highlighted in red color.
what I want to do is to change this code to compare text line by line to highlight the differences.. Can you please help me with this..
The code that I already have is as below:
For i = 1 To Len(InkNew.Value)
InkNew.SelStart = i - 1
InkNew.SelLength = 1
If Mid(InkNew.Value, i, 1) = Mid(InkOld.Value, i, 1) Then
InkNew.SelStart = i
InkNew.SelLength = 1
InkNew.SelColor = vbBlack
Else
InkNew.SelStart = i - 2
InkNew.SelLength = 1
InkNew.SelColor = vbRed
End If
Next
x = x + 1