ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to avoid clearing undo stack after macro? (https://www.excelbanter.com/excel-programming/296292-how-avoid-clearing-undo-stack-after-macro.html)

Auric__

How to avoid clearing undo stack after macro?
 
Hmm... Excel 2000 SR-1... every time pretty much any VBA is run (except
toggling the gridlines), the undo stack gets cleared. Very annoying.
Anyone know a way to avoid it? (FWIW, I *don't* need to undo the VBA
actions.)
--
auric "underscore" "underscore" "at" hotmail "dot" com
*****
My 386 does an infinite loop in 4.68 sec.

Tushar Mehta

How to avoid clearing undo stack after macro?
 
AFAIK, there is no simple way to protect the undo stack. More
important, I don't know what it means to 'undo' something after the
execution of VBA code -- code that could have made the very idea of
undoing something meaningless. [As an example, suppose the last non-
VBA act was to bold cell A1. Subsequently, the VBA code deletes row 1.
What would it mean to undo the bolding of cell A1?]

I imagine someone has devloped some complex set of gyrations that will
allow your VBA code to recreate the undo stack after its own actions
are complete, but it has always seemed too much work to figure out. ;-)

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
ess says...
Hmm... Excel 2000 SR-1... every time pretty much any VBA is run (except
toggling the gridlines), the undo stack gets cleared. Very annoying.
Anyone know a way to avoid it? (FWIW, I *don't* need to undo the VBA
actions.)


Auric__

How to avoid clearing undo stack after macro?
 
On Mon, 26 Apr 2004 14:51:58 GMT, Tushar Mehta wrote:

AFAIK, there is no simple way to protect the undo stack.


Yeah, I know. <g Didn't think it would be simple.

More
important, I don't know what it means to 'undo' something after the
execution of VBA code -- code that could have made the very idea of
undoing something meaningless. [As an example, suppose the last non-
VBA act was to bold cell A1. Subsequently, the VBA code deletes row 1.
What would it mean to undo the bolding of cell A1?]


Hmm... set the Bold property of A1 to False? That's an argument I
thought of before posting; stuff like that is probably why the undo
stack gets cleared in the first place

I imagine someone has devloped some complex set of gyrations that will
allow your VBA code to recreate the undo stack after its own actions
are complete, but it has always seemed too much work to figure out. ;-)


Would be nice if there was just an add-in or a DLL or something where
you just call a function that saves the stack (to a file or elsewhere in
memory) and another that restores it.
--
auric "underscore" "underscore" "at" hotmail "dot" com
*****
2 wrongs don't make a right - but 3 lefts do.


All times are GMT +1. The time now is 09:23 AM.

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