Hello, Mr. Greg Maxey provided the below code on another forum (msofficeforums). The purpose of the code was to relocate document comments directly into the text, placing them immediately after the text in question (the referenced text). This code works perfectly for its intended purpose. I would love to use the code but have found in practice that the comments become lost in the text and it is difficult to tell exactly what text is being referenced. If tracked changes are on, the inserted comments show up as inserted text. However, what I would love this code to do is:
1. Turn off track changes (in case it is on), I assume via:
ActiveDocument.TrackRevisions = False 'I don't want the inserted comment text to appear changes
ActiveDocument.TrackFormatting = False 'I don't want below highlights to appear as changes
2. Highlight (in Yellow) the referenced text (so it is then clear what text is in question or otherwise being referred to). I tried to select oRng and use oRng.Shading.BackgroundPatternColor = wdColorYellow but it would not do anything. I don't think I know how to properly select the oRng.
3. Highlight (in a different color) the newly inserted text (comment text).
Can anyone please help me with this? Such help would be most appreciated.
Doug
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim lngIndex As Long
Dim oRng As Range
For lngIndex = ActiveDocument.Range.Comments.Count To 1 Step -1
Set oRng = ActiveDocument.Range.Comments(lngIndex).Reference
oRng.InsertAfter " " & ActiveDocument.Range.Comments(lngIndex).Range.Text
ActiveDocument.Range.Comments(lngIndex).Delete
Next lngIndex
lbl_Exit:
Exit Sub
End Sub