Quote:
Originally Posted by Snakehips
Can you post your 'cleaned up' code and indicate where the error occurs?
Try stepping through the code using F8 key to see where it breaks.
If you are talking paragraphs of text then this will not be that useful as once it gets to the point where one textbox has had a word inserted or deleted all subsequent words will be out of step and therefore will be highlighted???
|
PHP Code:
Sub Compare_Text()
Set ws = ActiveSheet
ws.forms("Textbox3").TextFrame.Characters.Font.ColorIndex = 1
Arry1 = Split(ws.forms("Textbox1").TextFrame.Characters.Text, " ")
Arry2 = Split(ws.forms("Textbox2").TextFrame.Characters.Text, " ")
If UBound(Arry1) >= UBound(Arry2) Then
Arry3 = Arry1
Arry4 = Arry2
ws.forms("Textbox3").TextFrame.Characters.Text = ws.forms("Textbox1").TextFrame.Characters.Text
Else
Arry3 = Arry2
Arry4 = Arry1
ws.forms("Textbox3").TextFrame.Characters.Text = ws.forms("Textbox2").TextFrame.Characters.Text
End If
For i = 0 To UBound(Arry1)
wcc = Len(Arry3(i)) + 1
tc = tc + wcc
On Error Resume Next
If Not Arry3(i) = Arry4(i) Then
ws.forms("Textbox3").TextFrame.Characters(tc - wcc, wcc).Font.ColorIndex = 3
On Error GoTo 0
End If
Next i
End Sub
Code posted. I just changed the textbox names to match mine on the spreadsheet.
It breaks at ws.forms("Textbox3").TextFrame.Characters.Font.Col orIndex = 1
I'm using ActiveX Control Textbox. Could that be the issue here?