View Single Post
 
Old 03-16-2015, 01:14 PM
ksigcajun ksigcajun is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by Snakehips View Post
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(Arry2Then
    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 
0 To UBound(Arry1)
    
wcc Len(Arry3(i)) + 1
    tc 
tc wcc
    On Error Resume Next
    
If Not Arry3(i) = Arry4(iThen
         ws
.forms("Textbox3").TextFrame.Characters(tc wccwcc).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?
Reply With Quote