views:

118

answers:

1

IOW how do I make OOo's undo/redo work properly when a macro is executed?

This is related to my previous question: #853176

A: 

In Word this can be achieved by adding a bookmark to the document at the beginning of the macro which is then removed when the macro is done. When calling Undo the presence of such a special bookmark is checked and the undo operation is repeated until the special bookmark is removed from the document.

I assume a similar approach would work with OpenOffice.org as well.

See Can I create an undo transaction in Word or Excel? (VSTO) for more details.

0xA3
Thanks but it does not work :-(
cadrian
What is the problem with this? I'm not sure whether this was clear from my answer, but the sample code in the related post was for Microsoft Word. The basic idea should work in OOo as well I suppose, although it might be that you have to provide a custom undo button and maybe you have to use some other feature than a bookmark, e.g. clear text at a special position in the document.
0xA3
The problem is that it does not compile (unknown object). I tried to replace Application by either ThisDocument or StarDesktop but it did not compiler either (unknown function or property).
cadrian
Maybe I was still not clear enough, but the code is for *Microsoft Office*. I was just explaining the idea behind it. You will have to port the basic idea to OpenOffice.org Basic and create a new implementation.
0xA3