I'm trying to highlight the same Range using the following function,
range.Find.HitHighlight(range.Text.Substring(0, range.Text.Length));
But when I do this MS Word gives a message saying that "Word has reached the end of the Document. Do you want to continue from the beginning?" If I select "Yes" it works. But every time this code runs it gives the same message. I'm looking into how I can do the Highlight without the message box.
I've initially used the following snippet to highlight,
range.HighlightColorIndex = WdColorIndex.wdYellow
In this approach, it actually alters the original document even though you can use the code to remove the Highlight at a later stage. Therefore I've tried using the HitHighlight function to do the highlight since it does not create any permanent Highlights.
(I basically need to highlight a given Range without making any changes to the Original document itself.)
Any thoughts on this ?