Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push an operation onto the Excel undo stack?

Tags:

c#

excel

vsto

I'm building a VSTO Excel add-in that manipulates the values of multiple cells. I would like to allow the user to undo and redo the changes created by the add-in via the standard Excel features. I prefer to avoid using VBA.

Is this possible? If so, how?

Another question: is it possible to examine the existing undo/redo stack?

like image 776
Richard Pianka Avatar asked Apr 10 '13 15:04

Richard Pianka


1 Answers

You failed to mention which version of Excel/.NET/VSTO runtime you wish to use, but it does not really matter :]
Custom Undo just cannot be done without injecting VBA, where you would need to set an undo method for rolling back your actions, by using compensation (i.e. reverse operations) or by restoring a saved state.

like image 55
mousio Avatar answered Sep 30 '22 15:09

mousio