Neil,
I managed to get the Rich Edit control to pay attention to the replacement and it performs undo, but then it sends a 'changed' event and Code Replacement kicks in and performs the replacement again. I spent hours trying to intercept the Undo command without any luck. I can't devote any more time to it now, unfortunately.
-Kirk