How Can I Create a Custom Tool to Highlight Duplicate Words, In Different Colors on a Word Document RRS feed

  • Question

  • Hello,

    I'm trying to create a custom Word plugin tool that highlights duplicate words in different colors on a Word document.  Any suggestions on how this can be done?  

    For instance, if "think" and "book" are written in a document multiple times.  I want to highlight "think" in a specific color like green and "book" in red.  

    I can't seem to get the multi-coloring done within the word document.  Is it supported in Microsoft Word by creating a custom plugin?  Or do I need to create a custom layer that sits on top but hidden to the user and highlight the words on the document?


    • Moved by KareninstructorMVP Wednesday, October 23, 2019 10:17 PM Moved from forum
    Wednesday, October 23, 2019 7:55 PM

All replies

  • Hi,

    I suppose so many duplicated words will be found in a Word document.
    So, you need to define your requirements before writing code. You need to specify words to be ignored, such as "a", "the", "I,", "it", "to", "in", "for"... i.e. article, pronoun, preposition, etc. And need to specify colors to be used. 


    Ashidacchi --

    Wednesday, October 23, 2019 10:43 PM
  • I have coded the specific words I want to highlight in different colors.  However I have encountered a problem how to color the specific words on the document.
    Thursday, October 24, 2019 8:01 AM
  • Hi visualCoder,

    Thank you for providing more information.
    What language are you using, Word VBA,, C#, etc.?
    (I'm very poor at C#.)
    And I hope you will provide a part of your code related to the issue.


    Ashidacchi --

    Thursday, October 24, 2019 8:20 AM
  • Thank you. This is what i need
    Thursday, October 24, 2019 8:25 AM
  • Thank you. This is what i need
    What do you mean?

    Ashidacchi --

    Thursday, October 24, 2019 11:08 PM