Thread: [Solved] Styling Comments with VBA
View Single Post
 
Old 04-10-2019, 01:26 PM
inlanoche inlanoche is offline Windows 10 Office 2016
Novice
 
Join Date: Apr 2019
Posts: 14
inlanoche is on a distinguished road
Default Styling Comments with VBA

Our company wants to streamline how comments are made a tracked. For the most part I can deal with the tracking part, but I am having some issues with the 'making' of comments in the manner they want.

In the tracking part that I have done, I can stamp the current commenter's role it a protected area, and reference that as they make comments. Problem is when I create a comment via VBA, if I don't add text to the comment, then it opens the old annotations window at the bottom. If I sub in some text (such as "add Comment>") then word creates the comment in the new comment side pane, but sets the cursor back to the document. This is not desired as when the end user goes to type, it will write in the doc, not the comment area.

My next thought was to select the comment. This caused worse problems, though I might not be doing it the right way...
ActiveDocument.Comments(1).Range.Select

This lead to the comments side pane disappearing, and the revisions pane taking over, as well as the Show Comments button becoming greyed out.

The end result we are aiming for is that when the new custom Comments button is clicked, a new comment is made (the same as with the regular comment button), the Commenter's role is stamped (I got this working), the font color in the comment is set, and the focus (cursor) stays with the newly created comment (or pre-populated text is selected so when they type it is over written). Really, the last part is the most important.

I have played around with setting the comment to RichText and setting a start/end tag, which also looks nice, but though I record a macro, running the macro does not seem to take (seeming due to the fact that it works of a selection, and no selection is made).
Reply With Quote