R
Raj
Hi,
In long documents I work with (several 100 pages), I need to highlight
words that need to be reviewed. I do this using vba code. Next the
user has to navigate from one highlighted text to another for review.
To enable this I tried using the following code lines before the macro
for highlighting the words:
ActiveDocument.TrackRevisions = True
ActiveDocument.ShowRevisions = True
( I used these lines on the assumption that trackrevisions would track
the words that would be highlighted by the code that followed).
As this did not work, I used the following code on the document to
comment the highlighted words with comment text being the same as the
highlighted text:
Sub AddCommentstoHighlights()
Dim oDoc As Document
Dim s As String
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = ""
.Highlight = True
Do While .Execute
Selection.Comments.Add Selection.Range,
Selection.Text
Loop
End With
End With
End Sub
The reason was commenting the highlighted text was to enable the Track
changes feature for navigating betweenn the highlighted text (that
would now get commented)
This worked fine and was meeting my requirements till it encountered a
document where the table had a highlighted cell. It failed at the line
starting with "Selection.Comments" stating that the object was not
supported end of table row or something similar. What would be the fix
for this?
Is there any other way of navigating between highlighted words in a
document that mimics the functionality offerred by the Track changes
feature?
Thanks in advance for all the help.
Regards,
Raj
In long documents I work with (several 100 pages), I need to highlight
words that need to be reviewed. I do this using vba code. Next the
user has to navigate from one highlighted text to another for review.
To enable this I tried using the following code lines before the macro
for highlighting the words:
ActiveDocument.TrackRevisions = True
ActiveDocument.ShowRevisions = True
( I used these lines on the assumption that trackrevisions would track
the words that would be highlighted by the code that followed).
As this did not work, I used the following code on the document to
comment the highlighted words with comment text being the same as the
highlighted text:
Sub AddCommentstoHighlights()
Dim oDoc As Document
Dim s As String
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = ""
.Highlight = True
Do While .Execute
Selection.Comments.Add Selection.Range,
Selection.Text
Loop
End With
End With
End Sub
The reason was commenting the highlighted text was to enable the Track
changes feature for navigating betweenn the highlighted text (that
would now get commented)
This worked fine and was meeting my requirements till it encountered a
document where the table had a highlighted cell. It failed at the line
starting with "Selection.Comments" stating that the object was not
supported end of table row or something similar. What would be the fix
for this?
Is there any other way of navigating between highlighted words in a
document that mimics the functionality offerred by the Track changes
feature?
Thanks in advance for all the help.
Regards,
Raj