I can't believe I'm not able to find the answer to this (simple) question, but I can't. (This for instance didn't really help, nor could I find an answer here.) All I want to do is to figure out how to use Visual Basic (not VBA) to programmatically (i) change the font colour in a specific paragraph or range in a Word document, or (ii) highlight the same text in the document. I've used various permutations of:
myDoc.range.font.ColorIndex = Word.WdColor.wdColorRed
myDoc.range.Highlight = Word.WdColor.wdColorTurquoise
(where myDoc is a Word document), but keep getting error messages (eg, 'highlight not a member of range, or paragraphs, or whatever else I try). I can do this in VBA but doing this in VB has stumped me. I'm sure I'm missing something quite basic but I can't figure out what... I'm using Visual Studio 2015, Windows 10, Word 2010, and I've got Imports Microsoft.Office.Interop and Imports Microsoft.Office.Interop.Word at the top of my code. Thanks for any help you can offer. It's got to be simple!
HighlightColorIndex
. Have a look at this question – A Friend