Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Highlight selected word in MS Word document

$
0
0

In my application I select word in document, then I click on button and I want to highlight this word. It works but when I have word followed by comma or dot, for example ' hello, ', in docRange.Text is only character comma (without word 'hello').

What I am doing wrong?

Words doc;

doc=Globals.ThisAddIn.Application.Selection.Words; foreach (Range docRange in doc) { docRange.HighlightColorIndex = WdColorIndex.wdYellow; }



Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>