PDA

View Full Version : Runtime Error 5692 when using wildcard find



lesaussice
08-01-2013, 05:38 AM
I have an issue with Find in a sizeable Word application whereby Word returns a 5692 error in certain circumstances if using a wildcard.

The search string that causes an exception is checking specific paragraphs for the presence of anything other than an image (^g), a manual carriage return (^m) or a paragraph mark (^13) and so is expressed as [!^13^g^m]. I think it's the ^g which is causing the problem.

The code looks to run on Word 2003 without a problem, but causes a 5692 on Word 2010 or 2013 (I haven't tested it on 2007 yet). Simply trapping and ignoring the error isn't really an option - I need a workaround that will provide equivalent output.

Doug Robbins
08-03-2013, 05:35 PM
The issue is almost certainly caused by the different methods of handling graphics that started to be introduced in 2007 with the full change over being made in 2010. And it is probably for that reason that if you click on the Special drop down in the Find and Replace dialog when Use wildcards is checked, there is no Graphic item in the list in 2010, whereas, there is such an item in the list in 2003.

As a result you are probably going to have to run a separate test for paragraphs that are returned by the use of [!^13^m] to determine if there is an in-line shape in those paragraphs.

Note ^m is the code for a Page Break or a Section Break. I am not really sure what you mean by a "manual carriage return", but if it is where Shift+Enter has been used, then the code to use is ^l