This is how the pogram runs. when i clicked the commandbutton and set the checkbox to True, then it will count the words and at the same time it will highlight the words basing from what i am inputted in Text1.Text.
There is no problem with the counter, the only problem in the program, when i placed a code to highlight the word that the counter finds, it will not stop or the documents is in hang up....
but i want this work simultaneously.... both counting as well as highlighting based on the input in Text1.Text
VB Code:
With objWdRange.Find Do While .Execute(FindText:=wdText, Format:=False, _ MatchCase:=True, MatchWholeWord:=False, MatchAllWordForms:=False) = True count = count + 1 If Checkbox1.Value = True Then objWdDoc.Range.HighlightColorIndex = wdYellow .ClearFormatting .Replacement.ClearFormatting .Replacement.Highlight = True .Execute Replace:=wdReplaceAll End If Loop End With




Reply With Quote