Microsoft KB Archive/64575

EditSearch Command in WordBASIC Macro Finds Previous Character

PSS ID Number: Q64575 Article last modified on 05-14-1991

1.00

MS-DOS

Summary:

In a WordBASIC macro, the EditSearch command finds the previous character in the search before searching for the next occurrence. This behavior occurs because EditSearch remembers the last direction searched and uses that as the default if a direction is not specified. The first time this macro is run, it searches down, down, and up. The next time, it searches up, up, and up, resulting in different behavior. Using the last direction as the default is normal behavior.

More Information: For example, do the following: 1. In a new document, insert “foobargorp”. 2. Create a macro and enter the following: EditSearch “bar” EditSearch “^p” EditSearch “r”,0,0,0 3. Switch back to the document, position the insertion point at the

beginning of the document, and run the macro. After finding “bar”, the EOP between “foo” and “bar” is found, and then the “r” in “bar” is found. However, you might expect the EOP after “bar” to be found, and then the “r” in gorp. Note: This doesn’t happen if you omit the third line, which explicitly changes the search direction.

Reference(s):

Additional Keywords: w4wmacro