Look up GoTo.
Code:
Sub SearchTest()
' Charles Kenyon
' If word not found skip rest of macro
Const strWORDTOFIND As String = "Test"
With ActiveDocument.Range.Find
.Text = strWORDTOFIND
If .Found = False Then GoTo endofsub
End With
MsgBox strWORDTOFIND & " is present."
endofsub:
End Sub
You could also use:
Code:
If .Found = False Then Exit Sub