Here is the code which was working yesterday:
Sub TestError()
Dim Error As Integer
With Selection.Find
.ClearFormatting
.Font.Bold = True
.Execute FindText:="Error! Reference source not found."
If .Found = True Then
Error = MsgBox("Reference Source error detected - continue with macro?", 4)
If Error = 7 Then
Exit Sub
End If
End If
End With
End Sub
It should search for "Error! Reference source not found.", and if the document contains that string then it should throw a warning and ask the user if they want to continue.
Worked yesterday, now it's throwing
"The Find What text contains a Pattern Match expression which is not valid"
on .Execute FindText
.
Usually this error comes from something like a wildcard search with an unclosed set of brackets or something.
(I have tried turning it off and on.)