none
Comments color in Word

    Question

  • Hi,

    I'm trying to change the backgroud color of the comments I add to a word document. I can do it using Options.CommentsColor but this function modifies the color of all of the comments in the document.

    Is there any solution to modify the color of the comments in an independent way? Can I have various comments in a different color in the same document without change the author?

    Thursday, March 23, 2006 1:21 AM

Answers

  • Hi,

    You can programmatically set the color when you add the comment:

    Me.Comments.Add(Me.Range, "Here's my comment").Range.Font.Color =  _
        Word.WdColor.wdColorBlue

    Or you can loop through all comments in the document, and set the color. In the example below, I check the index of the comment and set the color accordingly.

    For Each comment As Word.Comment In Me.Comments
       
    Select Case comment.Index
           
    Case 1, 4, 7
                comment.Range.Font.Color = Word.WdColor.wdColorBlue
           
    Case 2, 5, 8
                comment.Range.Font.Color = Word.WdColor.wdColorYellow
           
    Case 3, 6, 9
                comment.Range.Font.Color = Word.WdColor.wdColorDarkRed
       
    End Select
    Next

    Kathleen McGrath
    http://blogs.msdn.com/vsto2/

    Monday, March 27, 2006 2:53 AM
  • Hi Jens,

    I don't know of a way to change the background color of the comment without changing the "reviewer". What you could do instead is set the HighlightColorIndex property, as the following code example shows:

    Me.Comments.Add(Me.Range, "Here's my comment").Range.HighlightColorIndex = _
        
    Word.WdColorIndex.wdBrightGreen

     

    Kathleen
    http://blogs.msdn.com/vsto2/

    Wednesday, April 05, 2006 12:18 AM

All replies

  • Hi,

    You can programmatically set the color when you add the comment:

    Me.Comments.Add(Me.Range, "Here's my comment").Range.Font.Color =  _
        Word.WdColor.wdColorBlue

    Or you can loop through all comments in the document, and set the color. In the example below, I check the index of the comment and set the color accordingly.

    For Each comment As Word.Comment In Me.Comments
       
    Select Case comment.Index
           
    Case 1, 4, 7
                comment.Range.Font.Color = Word.WdColor.wdColorBlue
           
    Case 2, 5, 8
                comment.Range.Font.Color = Word.WdColor.wdColorYellow
           
    Case 3, 6, 9
                comment.Range.Font.Color = Word.WdColor.wdColorDarkRed
       
    End Select
    Next

    Kathleen McGrath
    http://blogs.msdn.com/vsto2/

    Monday, March 27, 2006 2:53 AM

  • This only works for the foreground (text) color. Is there a way to get it to work with the background color?    E.g. a specific comment has red text on a blue background.
    Friday, March 31, 2006 10:19 AM
  • Hi Jens,

    I don't know of a way to change the background color of the comment without changing the "reviewer". What you could do instead is set the HighlightColorIndex property, as the following code example shows:

    Me.Comments.Add(Me.Range, "Here's my comment").Range.HighlightColorIndex = _
        
    Word.WdColorIndex.wdBrightGreen

     

    Kathleen
    http://blogs.msdn.com/vsto2/

    Wednesday, April 05, 2006 12:18 AM
  • thanks for your help,

    I already use the highlight option but the problem is that the comment is in the foreground so the highlight is invisible when a comment is added to same text section...
    Wednesday, April 19, 2006 4:26 PM