Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undo functionality w/ VBA?
Hi all -
I was wondering if anyone knew of a way to save the state of an excel workbook so that users could Ctrl-Z (i.e. undo) changes made by a VBA procedure or macro? For example, if my macro simply bold-faced a particular cell, Ctrl-Z would revert the formatting to whatever it was before? Any thoughts would be appreciated. TIA, Kevin |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undo functionality w/ VBA?
Kevin,
Running a VBA procedure clears Excel's undo buffer, effectively disabling the Undo feature. The closest you can get is to create a procedure that undoes your primary procedure, and use Application.OnUndo to put that procedure in the undo buffer. E.g., Sub AAAA() Application.OnUndo "Undo This", "UndoProc" End Sub Sub UndoProc() MsgBox "Undo code here" End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Kevin T. Ryan" wrote in message om... Hi all - I was wondering if anyone knew of a way to save the state of an excel workbook so that users could Ctrl-Z (i.e. undo) changes made by a VBA procedure or macro? For example, if my macro simply bold-faced a particular cell, Ctrl-Z would revert the formatting to whatever it was before? Any thoughts would be appreciated. TIA, Kevin |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undo functionality w/ VBA?
Kevin,
As Chip explained there isn't any built-in method. If you really need this type of functionality, then one general approach might be to save a current copy of the workbook before starting the VBA changes. If you need to revert back, then close the current workbook and open the previously saved file. Troy "Kevin T. Ryan" wrote in message om... Hi all - I was wondering if anyone knew of a way to save the state of an excel workbook so that users could Ctrl-Z (i.e. undo) changes made by a VBA procedure or macro? For example, if my macro simply bold-faced a particular cell, Ctrl-Z would revert the formatting to whatever it was before? Any thoughts would be appreciated. TIA, Kevin |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undo functionality w/ VBA?
Thanks guys, I'll probably try the "save-changes", re-open procedure
as it sounds a little easier to implement. Take care, Kevin "TroyW" wrote in message ... Kevin, As Chip explained there isn't any built-in method. If you really need this type of functionality, then one general approach might be to save a current copy of the workbook before starting the VBA changes. If you need to revert back, then close the current workbook and open the previously saved file. Troy "Kevin T. Ryan" wrote in message om... Hi all - I was wondering if anyone knew of a way to save the state of an excel workbook so that users could Ctrl-Z (i.e. undo) changes made by a VBA procedure or macro? For example, if my macro simply bold-faced a particular cell, Ctrl-Z would revert the formatting to whatever it was before? Any thoughts would be appreciated. TIA, Kevin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Go to functionality | Excel Worksheet Functions | |||
With autorecover on in Excel you lose your "undo" functionality. | Excel Discussion (Misc queries) | |||
Running of Worksheet Change Macro breaks undo functionality. | Excel Discussion (Misc queries) | |||
UNDO - how many times can I UNDO? | Excel Worksheet Functions | |||
Why is my undo function in Excel only can undo the last 1 or 2 ch. | Excel Worksheet Functions |