Searching all day to locate something that will find a key word or phrase then highlight (in yellow) the entire paragraph that follows that key word or phrase.
Ideally, if it could also pick up any listed items that follow the paragraph, that would be awesome, but I won’t push my luck.. Doing just the paragraph is still an exceptional improvement to my measly line.
The code I am using only highlights to the end of the line. =-(
I need it to identify a long list of requirements buried within Word documents and having the ability to highlight the listed details would be incredible but not mandatory.
(example):
“The Contractor shall turn in monthly status reports within ten business days after the end of each month. The report should include:
(a) Accomplishments
(b) Meetings and Outcomes
(c) Completed Travel and Purpose of Travel
Here’s the code I use to highlight to the end of the line:
Sub Find_Highlight_Word_to_End_of_Line() ‘BUT NEED IT TO HIGHLIGHT THROUGH END OF PARAGRAPH ‘AND HIGHLIGHT LISTED ITEMS IF APPLICABLE ‘LIKE THE LISTS IN THE EXAMPLE DOCUMENT Dim sFindText As String ‘Start from the top of the document Selection.HomeKey wdStory sFindText = “Contractor Shall” Selection.Find.Execute sFindText Do Until Selection.Find.Found = False Selection.EndKey Unit:=wdLine, Extend:=wdExtend Selection.Range.HighlightColorIndex = wdYellow Selection.MoveRight Selection.Find.Execute Loop End Sub
The attachment shows more of what I hope to achieve or something close to this extent of highlighting…
Thanks in advance!