Undo event

P

Praful

Hello All,

1/ Is it possible that we somehow restrict word to add entries in Undo stack.
else
2/ Is it possible that we group some events as one Undo event.

Please help as i am making a addin for office in vb.net

GS
 
J

Jezebel

There's no direct way to do it. There are several methods you can write for
grouping a series of undo instructions (I assume you're trying to undo
entire macro sequences) -- the trick is to put 'marker' instruction into the
undo stack at the beginning and end of your macro sequence. An easy choice
is to add a hidden bookmark (name begins with an underscore) and set it to
point to the beginning or end of the document. (Even if the document is
empty, these are different locations.)

When the user clicks Undo, undo one instruction and check if the bookmark
has changed. If so, keep on undoing until it changes again. And vice versa
for Redo.
 
P

Praful

Thanks a lot for the suggestion.

So is it sure that there is no option of restricting the events to be added
to the Undo Stack.
And can you please tell me that what you basically mean by Bookmark changing
again??????

GS
 
J

Jezebel

No, there is no way to manage the undo stack other than to clear it
completely. There is no Undo object as such, nor any methods for
manipulating it. (And there bloody well ought to be!)

If you have a bookmark defined in your document, and you change what the
book refers to -- ie, you reset the bookmark's Range property -- that
consitutes an event in the Undo list. Simplest is:

ActiveDocument.Bookmarks("_UndoMarker").End = 0 ' or .End = 1

That instruction inserts 'Change bookmark' into the Undo stack.
 
P

Praful

thanks,

i have tried that with 2 different bookmarks and that too working fine.....

thanks again
 
P

Praful

Hi,
Just a small querry. Is trapping the event possible in PowerPoint also and
HOW? As there is no bookmark concept in powerpoint so is there any way we can
simulate the same thing in powerpoint also.

GS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top