View Single Post
 
Old 08-18-2020, 09:53 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Based on the original code The following should do the trick


Code:
Sub salutation()
'Graham Mayor - https://www.gmayor.com - Last updated - 19 Aug 2020
Dim oRng As Range
Dim bFound As Boolean
Const strWORDTOFIND As String = "salutation"
    Set oRng = ActiveDocument.Range
    With oRng.Find
        Do While .Execute(findText:=strWORDTOFIND, MatchCase:=False)
            With oRng
                .Text = "It is a pleasure ...."
                .Bold = False
                .Italic = False
                .Underline = wdUnderlineNone
                .Collapse 0
                .Select
            End With
            bFound = True
            Exit Do
        Loop
    End With
    If Not bFound Then
        Beep
        MsgBox strWORDTOFIND & " is not present."
    End If
    Set oRng = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote