Sub CommentBox()
Dim range As range
Dim i As Long
Dim TargetList
Dim cm As Comment
TargetList = Array("Str1", "Str2")
For i = 0 To UBound(TargetList)
Set range = ActiveDocument.range
With range.Find
.Text = TargetList(i)
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute(Forward:=True) = True
Set cm = range.Comments.Add(range:=range, Text:="Hallo")
cm.Author = "InternalName"
cm.Initial = "Initials"
Loop
End With
Next
With ActiveDocument.Styles("Kommentartext").Font
.Size = 12
.Bold = True
.Italic = True
.Color = wdColorBlue
End With
End Sub
20 Nov 2012
Add Comments in MS-Word using VBA
This VBA procedure (1) Searches words ("Str1", "Str2",..) and adds commentboxes to it and (2) changes the initials used in the box:
Subscribe to:
Post Comments
(
Atom
)
Thank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC. https://www.searchenginejournal.com/social-sharing-sites/261563/
ReplyDelete