Undo list

G

Guest

I've just discovered the Application.OnUndo command, and written an undo
procedure for my macro. Is there a way to not have the existing stack of
undo commands cleared when code runs. ie: If there are already some items
in the Undo list, I'd like my undo procedure added to the list rather than it
replacing whatever's there.
Thanks
Rob
 
T

Tom Ogilvy

Many macro commands (probably most) clear the undo stack - probably any that
would affect the ability of excel to undo. In general, Undo will not undo
changes made by macros.
 
G

Guest

Thank you Tom.
....but everything I'm dealing with here is Undo-able: I've got the undo
command to work with with my macro, and the actions that were in my undo
stack before I ran "PerformSomeActions" must also be Undo-able, so surely
there must be a way to leave those items in the undo stack. Is it posible to
directly manipulate the Undo stack for example??

sub PerformSomeActions
'code to store some info about the initial state
'code to perform the actions
application.onundo "Undo the Actions", "UndoProcedure"
end sub
sub UndoProcedure
'code to restore initial state
end sub
 
T

Tom Ogilvy

so surely
there must be a way to leave those items in the undo stack.

I would guess not, particularly if you use onUndo


Is it posible to
directly manipulate the Undo stack for example??

Not that I am aware of.
 

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