thread707-1446480
I had the following
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "?^p"
.Replacement.Text = "?{^0013"
End With
Selection.Find.Execute Replace:=wdReplaceAll
Which was intended to add a curly bracket after end of line question marks but I got the VBA Run time error 5692.
I searched the net to very little avail other than the above thread where the question but not the solution was mentioned. The solution was to add
.MatchWildcards = False
i.e. to become
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "?^p"
.Replacement.Text = "?{^0013"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
I guess that wildcards are on by default. I am not sure why wildcards should throw an error but I do know that it would have found the wrong string (all end of line characters?) and that in fact just gave an error.
I report hereabove a (if unexplained) solution.
I had the following
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "?^p"
.Replacement.Text = "?{^0013"
End With
Selection.Find.Execute Replace:=wdReplaceAll
Which was intended to add a curly bracket after end of line question marks but I got the VBA Run time error 5692.
I searched the net to very little avail other than the above thread where the question but not the solution was mentioned. The solution was to add
.MatchWildcards = False
i.e. to become
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "?^p"
.Replacement.Text = "?{^0013"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
I guess that wildcards are on by default. I am not sure why wildcards should throw an error but I do know that it would have found the wrong string (all end of line characters?) and that in fact just gave an error.
I report hereabove a (if unexplained) solution.