5000 words is like 20 pages.
Depending on how you want to highlight differences in that quantity of text, have you considered using Word's document comparison feature?
The following code saves the textboxes into two Word documents and creates a third comparison document. You can then open the comparison document and use the track changes feature to see the differences.
Private Sub CommandButton1_Click()
Dim appWD As Object
Dim docWD As Object
Dim doc1 As Object
Dim doc2 As Object
Dim docComp As Object
Dim sFile1 As String, sFile2 As String, sComp As String
Dim sPath As String
sPath = "C:\somefolder\"
sFile1 = sPath & "mydoc1.docx"
sFile2 = sPath & "mydoc2.docx"
sComp = sPath & "Comp.docx"
'create word documents from textboxes
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
Set docWD = appWD.Documents.Add
With docWD
.Content.InsertAfter TextBox1.Text
.SaveAs sFile1
.Close
End With
Set docWD = appWD.Documents.Add
With docWD
.Content.InsertAfter TextBox2.Text
.SaveAs sFile2
.Close
End With
Set docWD = Nothing
'compare them using Word
Set doc1 = appWD.Documents.Open(sFile1)
Set doc2 = appWD.Documents.Open(sFile2)
appWD.CompareDocuments _
originaldocument:=doc1, _
reviseddocument:=doc2, _
Destination:=2
doc1.Close
doc2.Close
Set docComp = appWD.ActiveDocument
docComp.SaveAs Filename:=sComp
docComp.Close
appWD.Quit
Set doc1 = Nothing
Set doc2 = Nothing
Set docComp = Nothing
Set appWD = Nothing
MsgBox "done"
End Sub
Bookmarks