View Single Post
 
Old 10-26-2020, 09:56 AM
alex100 alex100 is offline Windows 7 64bit Office 2016
Advanced Beginner
 
Join Date: May 2020
Posts: 79
alex100 is on a distinguished road
Default Finding the position of a keyword in a seamless way

I am using the routine below to find the position of a keyword inside a document.

The problem is that the code will also select the matching text, and reposition the page so that this will be displayed at the top of the Word application.

How can I get the position of the keyword in a seamless way, without having it selected and the page repositioned, please?

Code:
With Selection.Find
    .ClearFormatting
    .Text = "keyword"
    .Font.Size = 10
    .Font.Name = Verdana
    .Forward = True
    .Wrap = wdFindStop
    .Execute
    If .Found = True Then
        Position = Selection.Start
    End If
End With
MsgBox (Position)
Alex
Reply With Quote