I have this simple sub in MS Word to search for a keyword.
It works fine, but the hits are highlighted in gray.
Q1. What line of code is needed to change to a more standout color (e.g. lt. yellow)?
Also, when a hit is found, the line containing the hit is always at the top of the screen.
Q2. How can I make it show 2 or 3 lines above the line of the hit, and still keep the highlight intact?
Sub Word_Find()
Dim FindText As String, Ask As Integer
Selection.HomeKey wdStory
FindText = InputBox("What would you like to search for?", "SEARCH FOR KEYWORD'")
If FindText = "" Then GoTo Stop1
Selection.Find.Execute FindText
Do Until Selection.Find.Found = False
Ask = MsgBox("Keyword was found - search for more?", vbYesNo, "SEARCH")
Selection.MoveRight
Selection.Find.Execute
Loop
Stop1:
MsgBox "No more found!"
If Ask = vbNo Then Exit Sub
End Sub