View Single Post
 
Old 10-26-2020, 03:05 PM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

If you don't want to change the selection, you use Ranges instead
Code:
Sub aTest()
  Dim aRng As Range
  Set aRng = ActiveDocument.Range
  With aRng.Find
    .ClearFormatting
    .Text = "keyword"
    .Font.Size = 10
    .Font.Name = "Verdana"
    .Forward = True
    .Wrap = wdFindStop
    .Execute
    If .Found = True Then
      MsgBox "Found at: " & aRng.Start
    Else
      MsgBox "Not found"
    End If
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote