Office Undo... Export to Array?

DrTribos
DrTribos used Ask the Experts™
on
Hi All

I am wondering if it is possible to export the undo history from MS Word / MS Excel and if there is simple (fast) code to achieve this.

I would be happy to fill an array / scripting dictionary / table with the descriptions of the available Undo Actions.

Any thoughts on how to achieve?

Kind regards,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2008
Commented:
The undo buffer is not available to us via the application object model so, no, you can't export it or access it in any way.

This has been a bone of contention with Microsoft for years as it makes controlling the undo buffer impossible. Did you know that the entire buffer is cleared when certain properties are set or methods invoked from VBA?

Kevin

Author

Commented:
Thank you for your comments, explains why I keep hitting a brick wall!

No I did not know that, can you provide a few examples?
Top Expert 2008

Commented:
Basically setting any worksheet property or invoking a method that changes a worksheet will reset (clear) the undo buffer. An example is accessing the UsedRange object. Any time the Worksheet.UsedRange property is accessed, the undo buffer is cleared.

This makes sense if you think about it. The undo buffer contains specific instructions to undo user actions. If VBA code executes and starts monkeying with the worksheet, that runs the risk of rendering the undo buffer's instructions obsolete. Rather than write mountains of logic to handle all possible cases - or record every VBA invoked worksheet change in the buffer, Microsoft chose to just clear the buffer when ANY worksheet property is changed from VBA. Easy solution to a very difficult problem.

Kevin

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial