This project has moved and is read-only. For the latest updates, please go here.

Support Undo in Excel AddIn

Nov 29, 2011 at 8:30 PM

Hello,

I 'd like to add Excel native undo feature into my addin.  Is it possible and how? thanks

My addin use C#, VS2010, ExcelDNA, NetOffice

Nov 29, 2011 at 8:42 PM

Hello,

long time no see, nice to read you again.
the simplest way to use:

excelApplication.Undo();

*kind regards
Sebastian

Nov 29, 2011 at 9:05 PM
Edited Nov 29, 2011 at 9:08 PM

(Yes,  have been silent for a while :)

oh, I did not make it clear.

I have an Excel UDF, in fact it is not a UDF, more like a process. It has no return value. The process kicks off a web service call based on input parameters asychronously

When getting response back from web service, it will plot result in Excel cells, data could be many rows * columns. After this process, undo button in Excel becomes disabled.  not sure why. So users can't undo previous steps.

I do not want to code undo myself and just want to use Excel built-in undo if possible

Nov 29, 2011 at 9:16 PM
Edited Nov 29, 2011 at 9:19 PM

excel can't undo your own steps of course.
you have implement the undo pattern at hand, not easy i find!
i nice tutorial you find here http://www.jkp-ads.com/Articles/UndoWithVBA00.asp
these tutorial shows you how create an own undo handler in excel.
the basic idea is: store, the current state and restore with excelApplication.OnUndo();

give me a little bit code and i will see its possible to find a way you can use undo from excel.
display the data is the key, you need a way with undo support. range.Value = "..." doesnt support undo, maybe another way exists here.

Sebastian

 

Nov 30, 2011 at 3:57 PM

thanks for the info. Will take a look