vba 如何更改插入在 MS Word 文档中的注释的背景颜色?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13318852/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change background color of a comment inserted in MS Word document?
提问by Jay
When I enter a comment in a document by clicking Review -> Comments -> New Comment
in MS Word 2010, word allows me to enter a comment. However, I am not able to change the background color of the comment box.
当我通过单击Review -> Comments -> New Comment
MS Word 2010在文档中输入评论时,word 允许我输入评论。但是,我无法更改评论框的背景颜色。
Is there a way by which background color of the comment box can be changed in MS Word?
有没有办法在 MS Word 中更改评论框的背景颜色?
I am asking this because, I am writing a VBA code to read all the comments inserted in a document. I also want to get information about the background color of the comment box. So, if it can be done using tools provided in the ribbon, it can be done through VBA as well. With this notion in mind, I am asking this.
我问这个是因为,我正在编写一个 VBA 代码来读取插入到文档中的所有注释。我还想获取有关评论框背景颜色的信息。因此,如果可以使用功能区中提供的工具来完成,也可以通过 VBA 来完成。带着这个想法,我问这个。
回答by Ahmad
I noticed that in Word, comments background color can't be decided by you, but they can be changed randomly (at least to me) by changing the username of the current user.
我注意到在 Word 中,评论背景颜色不能由您决定,但可以通过更改当前用户的用户名来随机更改(至少对我而言)。
For example, I originally had all my comments in pink boxes. Until I executed this
例如,我最初将所有评论都放在粉红色框中。直到我执行了这个
Application.UserName = "Ahmad MUTAWA"
After that, each comment I added is in a violet box. I did another change,
之后,我添加的每条评论都在一个紫色的盒子里。我做了另一个改变,
Application.UserName = "Ahmad"
and yet my new comments were added into a another shade of pink. Look at the attached screenshot. These comments appear in three different colors, but they all were added by me under different usernames.
然而我的新评论被添加到另一个粉红色阴影中。查看附加的屏幕截图。这些评论以三种不同的颜色出现,但都是我用不同的用户名添加的。
So what you can do is look for comments written by different Reviewer
s since each reveiwer is essentially a username.
因此,您可以做的是查找不同Reviewer
s撰写的评论,因为每个审阅者本质上都是一个用户名。
回答by Daniel
As Ahmadindicated, you can change the color of a comment by having the comment have a different author.
正如Ahmad指出的,您可以通过让评论拥有不同的作者来更改评论的颜色。
You can access all of the comments via ActiveDocument.Comments.
您可以通过 ActiveDocument.Comments 访问所有评论。
Something like the following:
类似于以下内容:
dim c as Comment
For each c in ActiveDocument.Comments
'Give each comment a unique author.
c.Author = "Author" & c.Index
next
Would change the author of every comment, and each comment would have a different color.
会改变每条评论的作者,每条评论都会有不同的颜色。
That being said, you should be able to read all comments and figure out if the colors are the same by tracking the author of the comment. However, there does not appear to be any practical way to update the color of the comment via code or even know the actual comment color.
话虽如此,您应该能够阅读所有评论并通过跟踪评论的作者来确定颜色是否相同。但是,似乎没有任何实用的方法可以通过代码更新注释的颜色,甚至不知道实际的注释颜色。
回答by Kayla
Go to Review-> Track Changes
Option and it will give you (the author) a chance to change the color of your comments so you can change it to a different color than red and blue
转到Review-> Track Changes
选项,它会让您(作者)有机会更改评论的颜色,以便您可以将其更改为与红色和蓝色不同的颜色