ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Undo list (https://www.excelbanter.com/excel-programming/323751-undo-list.html)

Rob

Undo list
 
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


Tom Ogilvy

Undo list
 
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.

--
Regards,
Tom Ogilvy

"Rob" wrote in message
...
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




Rob

Undo list
 
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


"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy

"Rob" wrote in message
...
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





Tom Ogilvy

Undo list
 
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.

--
Regards,
Tom Ogilvy


"Rob" wrote in message
...
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


"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy

"Rob" wrote in message
...
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








All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com