Ok, this one took me a couple of days. I was having an issue on the text color after a highlighted section staying the same color as the last highlight.
I was able to fix it with this line
textboxInput.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Black);
...
I take the text from a text box and test if its empty. If its not, then I split the string into and array by splitting it at the open space. Then I loop all the array items counting them. Then pass the results to a message box.
Second part is it opens a word file. Looping though it counting the words and then displays the results in a message...